Control FindControl(string target )
{
return FindControl(this, target);
}
static Control FindControl(Control root, string target)
{
if(root.Name.Equals(target))
return root;
for(var i=0;i<root.Controls.Count;++i)
{
if (root.Controls[i].Name.Equals(target))
return root.Controls[i];
}
for(var i=0;i<root.Controls.Count;++i)
{
Control result;
for(var k=0;k<root.Controls[i].Controls.Count;++k)
{
result = FindControl(root.Controls[i].Controls[k], target);
if(result!=null)
return result;
}
}
return null;
}
No comments:
Post a Comment