Modalpopupextender - Javascript error
Posted
by
clklachu
on Stack Overflow
See other posts from Stack Overflow
or by clklachu
Published on 2010-12-23T09:43:59Z
Indexed on
2010/12/23
9:54 UTC
Read the original article
Hit count: 418
ASP.NET
|ajaxcontroltoolkit
Hi, I just tried creating a simple sample with Modalpopup extender and Caledarextender. My design is like below.
<asp:UpdatePanel ID="pnlUpdate" runat="server">
<ContentTemplate>
<asp:Panel ID="pnlSample" runat="server" CssClass="frame">
<asp:TextBox ID="txtOSDate" runat="server"></asp:TextBox>
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="calDate" runat="server" TargetControlID="txtOSDate">
</asp:CalendarExtender>
<asp:CalendarExtender ID="calOSDate" runat="server" TargetControlID="txtDate">
</asp:CalendarExtender>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</asp:Panel>
<asp:Button ID="btnHiddenSample" runat="server" Style="display: none;" />
<asp:Button ID="btnSample" runat="server" CssClass="Button" Text="New Sample" />
<asp:ModalPopupExtender ID="mpeSample" runat="server" TargetControlID="btnHiddenSample"
CancelControlID="btnCancel" PopupControlID="pnlSample" DropShadow="false" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
When i run the sample and click the "New Sample" button, i get javascript error as "Error: Sys.InvalidOperationException: Two components with the same id 'ctl00_MainContent_calDate' can't be added to the application.' can't be added to the application." I checked the rendered HTML using DeveloperTools and i still found the asp Panel recreated. Someone please advice me what is the actual problem?
PS:When i comment the Calendar Extender, i dont get the error.
Regards, Lakxman Kumar C
© Stack Overflow or respective owner