tags:

views:

113

answers:

2

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
+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
thanks, forgot you can expose it as a property like this.
CoffeeAddict