May 5th, 2009 | No Comments

This is the simple code you can use, to loop through all the textboxes in your page. Not only textboxes you can change the textbox in
“(ctrl is Textbox)” to the control you’ll like to loop in your page.

 private  void processTextbox()
{
     foreach (Control ctrl in Page.Controls)
     {
          if (ctrl is TextBox)
          {
              //do something here
          }
          else
          {
              //do something here
          }
     }
}

Njoy coding :)

Written by Ajay Matharu

May 5th, 2009 at 10:15 am