Forums

 
ForumForumMainstream Foru...Mainstream Foru...HelpHelpLooking for the name of a control?Looking for the name of a control?
Previous Previous
 
Next Next
New Post
 3/7/2012 12:50 PM
 
 Modified By Michael  on 3/7/2012 1:51:46 PM

Try this:

as the last thing to do in the page load paste this code.

ArrayList controlsList = new ArrayList();
AddControls(Page.Controls,controlsList);

foreach (string str in controlsList)
{
Response.Write(str + "");
}
Response.Write("Total Controls:" + controlsList.Count);

Add this method to the class:

private void AddControls(ControlCollection page,ArrayList controlsList)
{
foreach (Control c in page)
{
if (c.ID != null)
{
controlsList.Add(c.ID);
}

if(c.HasControls())
{
AddControls(c.Controls, controlsList);
}
}

New Post
 3/7/2012 6:12 PM
 

What problem are you trying to solve?

Previous Previous
 
Next Next
ForumForumMainstream Foru...Mainstream Foru...HelpHelpLooking for the name of a control?Looking for the name of a control?