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?
Printable View
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:Quote:
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?
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.Code:foreach (Control c in myDataList.Controls)
{
Reponse.Write(c.ToString());
}