Thursday, September 2, 2010

Clearing textbox values after submitting

private void GetAllCtlClr(ControlCollection ctls)
{
foreach (Control c in ctls)
{
if (c is System.Web.UI.WebControls.TextBox)
{
TextBox tt = c as TextBox;
tt.Text = "";

}
if (c.HasControls())
{
GetAllCtlClr(c.Controls);
}
}

}

call this method in Page_Load event

(OR)
Write the following in the submit button click event:

Response.Write("");