C# code to get list of parent ASP.NET controls from Child ASP.NET controls
private ArrayList WalkthroughContainers(Control ctl)
{
ArrayList retContainers = new ArrayList();
Control parent = ctl.NamingContainer;
if (parent != null)
{
ArrayList sublist = WalkContainers(parent);
for (int j = 0; j < sublist.Count; j++) retContainers.Add(sublist[j]);
}
retContainers.Add(ctl.GetType().Name);
return retContainers;
}
{
ArrayList retContainers = new ArrayList();
Control parent = ctl.NamingContainer;
if (parent != null)
{
ArrayList sublist = WalkContainers(parent);
for (int j = 0; j < sublist.Count; j++) retContainers.Add(sublist[j]);
}
retContainers.Add(ctl.GetType().Name);
return retContainers;
}
No comments:
Post a Comment