Here is a snippet that I have used to find a control in ASP.NET recursively:
private static Control FindControlRecursive(Control Root, string Id)
{
if (Root.ID == Id)
{
return Root;
}
foreach (Control Ctl in Root.Controls)
{
Control FoundCtl = FindControlRecursive(Ctl, Id);
if (FoundCtl != null)
{
return FoundCtl;
}
}
return null;
}
No comments:
Post a Comment