Hello,
Approach 1-
Step1:
Create the following function in aspx.cs
private void ClearControls(ControlCollection ctrls)
{
foreach (Control ctrl in ctrls)
{
if (ctrl is TextBox)
((TextBox)ctrl).Text = string.Empty;
else if (ctrl is DropDownList)
((DropDownList)ctrl).ClearSelection();
ClearControls(ctrl.Controls);
}
}
Step2: Call the ClearControls function in the Submit button click event like this
ClearControls(Page.Controls);
Approach2-
Use this code inside button click event:
Form.Controls.Clear();
Approach3-
Use this code inside button click event:
Page.Response.Redirect(Page.Request.Url.RawUrl)
Approach4-
Use this code to redirect to the same page
Response.Redirect(Request.Url.PathAndQuery, true);