Click here to Skip to main content
15,908,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

C#
foreach (Control ctrl in this.Controls)
               {
                   if (ctrl is TextBox )
                   {
                       TextBox tb = (TextBox)x;
                       tb.Text = "";
                   }

}
like above is it any way is there for web application to loop all controls. Any help would be appreciated.

Thanks
Uday
Posted

You have to write a recursive method so you can search container controls as well, but that general approach should work.
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900