Search code examples
c#asp.netuser-controlscustom-server-controls

how do embed ascx into dll (asp.net Server Control)


i have an ascx userControl that want to call from my servercontrol i call myUC.render(writer) to render output of my userControl. but dont render

how can i do this?


i load uc from dll with this help link http://www.codeproject.com/KB/user-controls/EmbeddedUserControl.aspx this project help you to embed an ascx into server control and load it

but i have a problem with images and script loading images and script does not work


Solution

  • For user control to work, you have to host it into page or some other control. I will suggest that you load your user control in the server control (as early as possible in control life cycle - perhaps OnInit) and then in server control's render method, use the render call of user control as needed.