Click to See Complete Forum and Search --> : What is the best way to examine nested controls.


sager
November 4th, 2002, 06:45 PM
I have several web server controls that are nested inside a datalist control. What is the best way to programmatically access those controls and their properties?

CPCericola
November 9th, 2002, 06:32 AM
Originally posted by sager
I have several web server controls that are nested inside a datalist control. What is the best way to programmatically access those controls and their properties?

In C#, you can do this to reiterate over the list of controls:


foreach (Control c in myDataList.Controls)
{
Reponse.Write(c.ToString());
}


That will display the type of evey child control to the datalist. If you're looking for a certain control, you can search for it by type.