Hi,
I have tried load the user control programmatically in event Page_Load, it works for me too. Below is the code what I am testing. Does this way work for you too?
- <%@ Page Language="c#" ValidateRequest="false" %>
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <script runat="server">
- protected override void OnLoad(EventArgs e)
- {
- Control cc = this.LoadControl("~/WebUserControl.ascx");
- cc.ID = "editor1";
- panel1.Controls.Add(cc);
- base.OnLoad(e);
- }
- </script>
- <body>
- <form id="Form1" method="post" runat="server">
- <asp:Panel ID="panel1" runat="server"></asp:Panel>
- </form>
- </body>
- </html>
Regards,
Ken