Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Commented Issue: ModalPopupExtender gets hidden from any button [27902]

$
0
0
Any button inside a ModalPopupExtender hides the modal. It doesn't matter if the button is set as CancelControlID or OkControlID.

In the following example, both btnFoo and btnBar closes the modal.

```
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="btnOpen" runat="server" Text="Open" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
CancelControlID="btnModalCancel" OkControlID="btnModalOkay" TargetControlID="btnOpen"
PopupControlID="Panel1">
</cc1:ModalPopupExtender>

<asp:Panel ID="Panel1" Style="display: none" runat="server">
<asp:Button ID="btnModalCancel" runat="server" Text="Cancel" />
<asp:Button ID="btnModalOkayl" runat="server" Text="OK" />
<asp:Button ID="btnFoo" runat="server" Text="Foo" />
<asp:Button ID="btnBar" runat="server" Text="Bar" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>



```
Comments: Ok, try this: ``` <asp:Button ID="btnFoo" runat="server" Text="Foo" OnClick="btnBar_Click" /> ```   And here is code behind: ``` protected void btnBar_Click(object sender, EventArgs e) { // some code ModalPopupExtender1.Show(); } ``` In this case, the modal popup will still be shown after a postback.   Best regards,

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>