Hi.
I would like to be able to iterate recursively through a
web page, and for every control on the page, chech if it
has "CssClass" property and to be able to change it.
How can this be done?
Thanks
Roy

Re: reflection - discover control's properties. by Piotr

Piotr
Mon Aug 11 04:04:24 CDT 2003

Hi

You can use classes TypeDescriptor and ProperyDescriptor.

To obtain values of every property of a class use static function
TypeDescriptor.GetProperties.
This function returns PropertyDescriptorCollection. Then you can iterate
through the collection and get the value of each property using GetValue
function.

Form f = new Form();
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(f);
foreach(PropertyDescriptor p in props)
if ( p.GetValue(f) != null )
Console.WriteLine(p.GetValue.ToString(f));

best regards
Piotr Walczak

Uzytkownik "roy" <salomonovitz@yahoo.com> napisal w wiadomosci
news:00c101c35fbe$c246a320$a001280a@phx.gbl...
> Hi.
> I would like to be able to iterate recursively through a
> web page, and for every control on the page, chech if it
> has "CssClass" property and to be able to change it.
> How can this be done?
> Thanks
> Roy
>