Custom Control within a Control Control

I am developing a custom controls that will render headers for different web sites.  Within these controls, I want to place another custom control that will change the language.  I created the language control and had it implement IPostBackDataHandler.  This control works fine if I drag it on a new web form, but if I tell a header custom control to render it problems occur.  The Language Selector custom control does not have a Page member anymore and the event handlers do not work.  Does anyone have any experience with doing something similiar?  Anyone have any suggestions?

Thanks,
Rich
0
rjl7002
8/12/2003 1:53:54 PM
📁 asp.net.hosting-open-forum
📃 4216 articles.
⭐ 0 followers.

💬 2 Replies
👁️‍🗨️ 1993 Views


Hate to see posts go unanswered, but can't really help without seeing some code. How are you declaring the Language Selector?

Steven Bey

Recursion: see Recursion
0
stevenbey
8/27/2003 3:25:38 PM
I agree that some code examples would be nice, but here's a suggestion. One thing I've found with embedded custom controls is that they usually don't render properly unless you've added the child control to the parent's control tree before you render the child. Try adding something like this to your header control, then render the child normally:

protected override void CreateChildControls()
{
this.Controls.Clear();
_langCtrl = new LanguageControl();
this.Controls.Add(_langCtrl);
}
Hope this helps,
Rob
0
HiTopTech
8/29/2003 3:23:33 PM
Reply: