user control inside a user control

i've currently got one of my pages setup so that I have a user control, CreateMessage.ascx, inside my main user control, ViewChangeMessages.ascx. My problem is that i've got a method inside my main usercontrol that either hides or shows the second user control, but it doesn't work, mainly coz i found out that the second user control is loaded before my main one. Is there any way i can get around this?
0 dodgster02 11/17/2003 10:59:50 AM

You could try to load the second user control programmatically the OnPreRender method of your main user control.
You'll need to add a placeholder in the spot you want the user control to show up, then just add the UserControl to the Controls collection of the placeholder.

protected override void OnPreRender(object sender, EventArgs e)
Control _createMessage = LoadControl("CreateMessage.ascx");
0 drazz75 11/17/2003 3:18:31 PM
thanks for that, i can get the control to load at the right time, but the previous way I had it was the following: 

and I was passing variables through that would determine whether some of the child controls within CreateMessage.ascx would be hidden or not. Is it still possible to do this using your example above?
0 dodgster02 11/18/2003 11:36:52 AM

(Thread closed)