views:

31

answers:

2

How to Get list of controls inside a specific div in ASP.NET

A: 

Providing your div has an ID attribute (say yourDiv) and runat="server", and providing you're using C#, try:

    for (int i = 0; i < yourDiv.Controls.Count; i++)
    {
        Console.WriteLine(yourDiv.Controls[i].ToString());
    }

to list the types of the controls contained within the div.

Brissles
A: 

Every asp.net Control has a parameter Controls

foreach ( Control ctrl in myDivCtrl.Controls ) { string ctrlId = ctrl.ID; }
ibram