Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Loading user control from server control (http://www.velocityreviews.com/forums/t775138-loading-user-control-from-server-control.html)

Petr PALAS 01-06-2005 02:15 PM

Loading user control from server control
 
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.
************************************************** ******************************



Petr PALAS 01-06-2005 02:58 PM

Re: Loading user control from server control
 
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.
************************************************** ******************************


"Petr PALAS" <palas@atlas.cz> wrote in message
news:%23dIPro$8EHA.2600@TK2MSFTNGP09.phx.gbl...
> 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.
> ************************************************** ******************************
>





All times are GMT. The time now is 08:19 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.