Wednesday, March 28, 2012

Modal Popup Error Message

There have been several posts regarding the modal popup control and beta 2 but I haven't seen one regarding my issue yet. Here is a code sample of the page:

<atlas:ModalPopupExtender ID="mpeCutAreas"
BackgroundCssClass="modalPopupBg"
TargetControlID="btnHidden"
PopupControlID="pnlCutAreas"
CancelControlID="btnCloseCutAreas"
DropShadow="true"
runat="server" />
<asp:Button ID="btnHidden" UseSubmitBehavior="false" Style="visibility: hidden;" runat="server" />
<asp:Panel ID="pnlCutAreas" Style="display: none;" CssClass="modalDialog" runat="server">
<input type="hidden" id="hidGeographyId" runat="server" />
<div>
<h2>Cut Areas</h2>
<asp:DataGrid CssClass="grid" ID="dgCutAreas"
AutoGenerateColumns="false"
ShowFooter="true"
OnItemCommand="dgCutAreas_ItemCommand"
OnItemDataBound="dgCutAreas_ItemDataBound"
ShowHeader="true"
GridLines="None"
DataKeyField="CA_ID"
runat="server">
<HeaderStyle CssClass="gridHeader" />
<ItemStyle CssClass="gridItem" />
<AlternatingItemStyle CssClass="gridAltItem" />
<FooterStyle CssClass="gridFooter" />
<Columns>
<asp:TemplateColumn HeaderText="Active">
<ItemTemplate>
<asp:HiddenField ID="hidCutAreaId" Value='<%# DataBinder.Eval(Container.DataItem, CutArea.ColumnNames.CA_ID) %>' runat="server" />
<input type="checkbox" id="chkIsActive" runat="server" />
</ItemTemplate>
<FooterTemplate>
<input type="checkbox" disabled="disabled" id="chkIsActive" runat="server" />
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Name">
<ItemTemplate>
<input type="text" id="txtName" size="22" value='<%# DataBinder.Eval(Container.DataItem, CutArea.ColumnNames.CA_Name) %>' runat="server" />
</ItemTemplate>
<FooterTemplate>
<input type="text" id="txtName" size="22" runat="server" />
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<FooterTemplate>
<asp:Button ID="btnAddCutAreaRow" CommandName="Insert" Text="Add" runat="server" />
</FooterTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
<br />
<asp:Button ID="btnSaveAllCutAreas" OnClick="btnSaveAllCutAreas_Click" Text="Save" runat="server" />
<asp:Button ID="btnCloseCutAreas" Text="Close" runat="server" />
</div>
</asp:Panel>


The error I am recieveing is this:

The control 'btnHidden' already has a data item registered.
Parameter name: control


One strange thing I did notice, is that if I set AutoEventWireup = false the problem goes away, but of course I'd rather not have to manually wire up the page when using C#. Not sure if that is a clue or not.

This code did work fine under beta 1.

Any help would be great.

Thanks,
Frank

Pasting your sample into a page and getting it running seems to work for me with either setting of AutoEventWireup. Perhaps acomplete, simple, self-contained sample page that demonstrates the problem would help? Thank you!

Having the same problem.. anyone have any idea what would cause it..

In my situation I am using an updatepanel in a masterpage, and inside that I have a control createaccount, that has a panel in it which I have assigned to the modal popup extender, which sits in the masterpage it works fine, but after I trigger a postback manually, and re-show the panel, I get that error! Its strange cause if I don't call the mpecreateaccount.show() method it works fine, I only seem to get it after i call mpecreateaccount.show()..

Any ideas would be greatly appreciated!

No comments:

Post a Comment