all control properties in webform

R

Rahim

i want to change all the label control style Properties,
server control properties at runtime
how should i call all the label at runtime, which is
present at webform,

any collections????

i can't remember each control name on the form.

thanks help me
 
K

Kevin Spencer

Every ASP.Net Control has a collection of Controls called "Controls." You
can loop through that collection of a Control to find all the Controls
contained in it. To identify Labels in that Collection you would use
Reflection. The tricky part is that I don't know whether all of your labels
are contained within the same Controls Collection. For example, you would
typically start at the WebForm level (the WebForm is the <form> element in
the Page). Most ASP.Net Controls must reside within an HtmlForm Control in
order to work. However, looping thtough tyhe Controls Collection of the Form
may not reveal all of your labels. For example, if a label is inside another
Control in the Form, it is a member of the Controls Collection of the nested
Control, not the Form. You could write a recursive function to loop through
all of the Controls in a Control, and then call itself to loop through all
the Controls of each Child (etc) to find all of them.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top