/// <summary> /// Finds a Control recursively. Note finds the first match and exists /// </summary> /// <param name="ContainerCtl"></param> /// <param name="IdToFind"></param> /// <returns></returns> public 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; }
Usercontrol using codebehind file in app_code
Hey there,
I am trying to create a usercontrol with a label in it (this is quite easy).
However in the Page_Load method I am trying to modify the label but it returns an error
Object reference not set to an instance of an object.
I have been trying to reference to it like this:
But it does not work, what am I doing wrong?
Thanks
Scott
I found out myself (thanks to Rick Strahl: http://www.west-wind.com/Weblog/posts/5127.aspx):
is working on a reply...