2009-04-02 21:15:25 UTC
Hi I have a really urgent problem and need some advice...
I'm using dynamic user controls with ajax.net controls inside. But when I load the control using a anthem button, the script reference of the ajax controls get lost.
Here is the html body code in the page:
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
<asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">ASP ADD</asp:LinkButton>
<anthem:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">Anthem ADD</anthem:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
The buttons events:
protected void LinkButton2_Click(object sender, EventArgs e)
{
Control prueba = LoadControl("WebUserControl1.ascx");
this.Panel1.Controls.Add(prueba);
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Control prueba = LoadControl("WebUserControl1.ascx");
this.Panel1.Controls.Add(prueba);
}
User control HTML:
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" PopupButtonID="Button1">
</cc1:CalendarExtender>
<asp:Button ID="Button1" runat="server" Text="Button" /><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Panel ID="Panel1" runat="server">
<asp:Panel ID="Panel2" runat="server">
Header
</asp:Panel>
<asp:Panel ID="Panel3" runat="server">
Body
</asp:Panel>
</asp:Panel>
<cc1:DragPanelExtender ID="DragPanelExtender1" runat="server" DragHandleID= "Panel2" TargetControlID = "Panel1">
</cc1:DragPanelExtender>
that's it, please check the behavior in both cases.
Thx