<asp:TemplateField HeaderText="#">
<ItemTemplate>
<%#Container.DataItemIndex +1 %>
</ItemTemplate>
<ItemStyle Width="2%" />
</asp:TemplateField>
Wednesday, 20 July 2011
Friday, 15 July 2011
Redirect after alert message
public void showmessage(string msg, string pageName)
{
ScriptManager.RegisterStartupScript(this, GetType(), System.Guid.NewGuid().ToString(), "alert('" + msg + "');window.location='" + pageName + ".aspx';", true);
}
{
ScriptManager.RegisterStartupScript(this, GetType(), System.Guid.NewGuid().ToString(), "alert('" + msg + "');window.location='" + pageName + ".aspx';", true);
}
Tuesday, 12 July 2011
Clear controls contents in a page
public void clearall(Control pg)
{
try
{
Control ctrl = new Control();
ContentPlaceHolder cph = new ContentPlaceHolder();
foreach (Control ctr in pg.Controls)
{
if (ctr.Controls.Count > 0)
{
clearall(ctr);
}
else
{
string stype = ctr.GetType().ToString();
stype = stype.Substring(26);
if (stype == "TextBox")
{
TextBox tb = new TextBox();
tb = (TextBox)ctr;
tb.Text = "";
}
if (stype == "DropDownList")
{
DropDownList ddl = new DropDownList();
ddl = (DropDownList)ctr;
ddl.ClearSelection();
}
if (stype == "CheckBoxList")
{
CheckBoxList cbl = new CheckBoxList();
cbl = (CheckBoxList)ctr;
cbl.ClearSelection();
}
}
}
}
catch (Exception ex)
{
throw ex;
}
}
{
try
{
Control ctrl = new Control();
ContentPlaceHolder cph = new ContentPlaceHolder();
foreach (Control ctr in pg.Controls)
{
if (ctr.Controls.Count > 0)
{
clearall(ctr);
}
else
{
string stype = ctr.GetType().ToString();
stype = stype.Substring(26);
if (stype == "TextBox")
{
TextBox tb = new TextBox();
tb = (TextBox)ctr;
tb.Text = "";
}
if (stype == "DropDownList")
{
DropDownList ddl = new DropDownList();
ddl = (DropDownList)ctr;
ddl.ClearSelection();
}
if (stype == "CheckBoxList")
{
CheckBoxList cbl = new CheckBoxList();
cbl = (CheckBoxList)ctr;
cbl.ClearSelection();
}
}
}
}
catch (Exception ex)
{
throw ex;
}
}
Sunday, 10 July 2011
Import CSS file within a child page
<% Response.Write(" <link href='ChildPageStylesheet.css' type='text/css' />"); %>
Subscribe to:
Comments (Atom)