Clear All TextBox Values Or Reset Function

Syedshakeer
Posted by Syedshakeer under ASP.NET category on | Views : 8919
How to Clear All TextBoxes values without Knowing textbox id(name) ?


Control myForm = Page.FindControl("Form1");
foreach (Control ctl in myForm.Controls)
if (ctl.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
((TextBox)ctl).Text = "";

Comments or Responses

Login to post response