Thank you, Eliyahu, I thought about CSS as a solution for the specific case
I cited. My question more generally is about ways to programmatically
investigate the page, and I'd still like to know all of the ways I might
manage this.
I thought of another case that would be useful in addition to my earlier
query. So what I'd still like to know at this point is:
* how can I loop recursively through all controls on the page and manipulate
controls of type X
* how could I loop recursively through all controls on a page and manipulate
user controls with custom properties set to a specific value? What is the
last point in the page lifecycle that I would still be "permitted" to run
such a function (i.e. could some user control values be set
programmatically, and my looping function be run prior to the page being
rendered?)
-KF
Eliyahu Goldin said:
Although you can loop recursively through all controls on the page
starting from this.Controls collection, check the type of every control
and take actions for required types, it doesn't seem to be an elegant
solution. Why don't you manipulate css rules instead? A css for span will
cover all labels. If you change it programmatically, all labels will
change their appearance.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
Ken Fine said:
I'm interested in programmatically manipulating groups of ASP.NET
controls by type. Can someone suggest code for the following?
Loop through, say, all label controls on a page, and assigning a CssClass
to them, or programmatically making the Visible/not Visible.
If applied to a containing page, such a function would traverse all user
controls statically and dynamically placed on the page, correct?
Thanks,
-KF