24Sep/092
How to access the sub controls in the PagerTemplate in DataPager .NET control
At least for me, I can not use MyDataPage.FindControl("LblPage") to find my LblPage control in the PagerTemplate.
I have to use an recursive way to locate it.
public static Control FindControlRecursive(Control container, string id)
{
if (container.ID == id)
return container;
foreach (Control control in container.Controls)
{
Control foundControl = FindControlRecursive(control, id);
if (foundControl != null)
return foundControl;
}
return null;
}
September 26th, 2009 - 04:39
nice algorithm to explain a recursive method, I always feel dizzy with recursive staff
September 27th, 2009 - 14:39
Too bad, seems that is the only way can locate the sub controls in this DataPager .Net control.