Stop postback closing a ModalPopupExtender Panel
Sunday 10 May 2009
If you are experiencing problems with the postback actions of buttons closing a ModalPopupExtenter Panel, the resolution is really quite simple.
All you have to do is make sure you put the Update Panel within the Panel being used for you ModelPopupExtender Panel an example of this is below:
- <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="LinkButton1" PopupControlID="pnlImg" BackgroundCssClass="popupbackground" okcontrolid="CancelButton" cancelcontrolid="CancelButton">
- </cc1:ModalPopupExtender>
-
- <asp:Panel ID="pnlImg" runat="server" CssClass="popuppanel">
- <asp:updatepanel ID="UpdatePanel1" runat="server">
- <ContentTemplate>
- <div id="popup">
- <h1><asp:Label ID="lblTitle2" runat="server" /></h1>
- <br /><br />
- <asp:image id="img2" runat="server" cssclass="noborder" /><asp:textbox id="txtImageID2" runat="server" visible="false" />
- <br /><br />
- <table cellpadding="0" cellspacing="0" class="popuptable">
- <tr>
- <td class="popuptableleft">
- <asp:LinkButton ID="btnPrev" runat="server" Text="Previous" onclick="btnPrev_Click" />
- </td>
- <td class="popuptablemiddle">
- <asp:LinkButton ID="CancelButton" runat="server" Text="Close" onclick="CancelButton_Click" />
- </td>
- <td class="popuptableright">
- <asp:LinkButton ID="btnNext" runat="server" Text="Next" onclick="btnNext_Click" />
- </td>
- </tr>
- </table>
- </div>
- </ContentTemplate>
- </asp:updatepanel>
- </asp:Panel>
So as you can see from the above, just moving that UpdatePanel inside the Panel is all you need to do. One thing to remember though, is that if you have used more AJAX features on your page, you will need to add more update panels and ensure the AJAX elements are within them.
|
(32)
|
|
|