Loading user control from server control

P

Petr PALAS

Hello,

I'm trying to load a user control (ASCX) from server control (*.vb) and
display it on the page. The user control is displayed, but its postback
events do not work - when I press a button, nothing happens.

When I load the same user control directly from an ASPX page using the
Page.LoadControl method, everything works fine.

The server control looks like this:

Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
EnsureChildControls()
mControl.RenderControl(output)
End Sub

Protected Overrides Sub CreateChildControls()
mControl = Page.LoadControl("mycontrol.ascx")
Me.Controls.Add(mControl)
End Sub

Any idea where I make the error?

Thank you.

Best Regards,

Petr Palas
********************************************************************************
Kentico Software
WWW: www.kentico.com
Blog: www.kentico.com/blog
Kentico CMS - The most affordable CMS for ASP.NET professionals.
********************************************************************************
 
P

Petr PALAS

Sorry, I've just solved this: I needed to add

Implements INamingContainer

Regards,

Petr Palas
********************************************************************************
Kentico Software
WWW: www.kentico.com
Blog: www.kentico.com/blog
Kentico CMS - The most affordable CMS for ASP.NET professionals.
********************************************************************************
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top