I have a user control within a user control. I want to reference the nested user control from the code-behind of a page using user control #1. And user control#1 has nested usercontrol #1
A:
Use the FindControl method.
UseControl1.FindControl("IdOfNestedUserControl");
Brandon
2009-07-20 16:28:59
+1
A:
You want to call it from the page itself, so you'll have to expose the nested user control in the user control itself.
public Control NestedUserControl
{
get{ return FindControl(nameOfUserControl);}
}
And in the code behind of the page just do:
UserControl1.NestedUserControl
Rorschach
2009-07-20 16:39:07
thanks, forgot you can expose it as a property like this.
CoffeeAddict
2009-07-20 17:49:51