Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How can you loop through all controls on an ASP.NET Web form?

user-image
Question ajoutée par Zaid Rabab'a , Software Development Team Leader , Al-Safa Co. Ltd.
Date de publication: 2013/01/08
marwa khalaf
par marwa khalaf , .Net Developer , Sands National Academy

You can easily traverse all controls on a form via the Web Form’s Controls collection.
The GetType method can be used on each control to determine its type and how to work with it.
Now, it gets tricky because the form contains a tree of controls; that is, some controls are contained within others (think of a Table).
You would have to recursively loop through the controls to make sure everything is processed.

Omar Alsoudani
par Omar Alsoudani , Software Engineer , Codeobia , Amman

Web Form’s Controls collection

Furqan Ul Karim
par Furqan Ul Karim , Senior Delivery Manager (Contract) , Virgin Red

using for each loop with the page controls collection .
Easy isn't it.

More Questions Like This