Composite control with custom control

F

Frédéric Mayot

Hi,
I have a custom composite webcontrol (Frameset) which inherits from the
panel webcontrol. This control uses another control named Menu. If I don't
add mMenu with Controls.Add(mMenu), the menu doesn't render when
mMenu.RenderControl(writer) is invoked. But, if I put Controls.Add(mMenu),
the control is rendered twice (which is normal since I call
MyBase.RenderChildren(writer)).
What should I do ?
Thanks
Fred

<ToolboxData("<{0}:Frameset runat=server></{0}:Frameset>")> _
Public Class Frameset
Inherits System.Web.UI.WebControls.Panel
Implements INamingContainer

Dim mMenu As Menu

Protected Overrides Sub RenderChildren(ByVal writer As
System.Web.UI.HtmlTextWriter)
writer.Write('blabla")
mMenu.RenderControl(writer)
writer.Write("blabla")
MyBase.RenderChildren(writer)
writer.Write("blabla")
End Sub

Protected Overrides Sub CreateChildControls()
MyBase.CreateChildControls()
mMenu = New Menu
Controls.Add(mMenu)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top