I want to show a modal popup when a user click on an asp button. The user must select an option of a panel. The value of the option selected must be saved to an input hidden and then the asp.net button must do a PostBack.
Can I do that?
Thank you!
It is possible for a ModalPopupExtender to be displayed using a postback. You'll need an invisible target control. The extender is attached to this hidden control.
<asp:Button runat="server" ID="btnShowModal" Text="Show"
OnClick="btnShowModal_Click" />
<asp:Button runat="server" ID="HiddenForModal" style="display: none" />
<ajaxToolKit:ModalPopupExtender ID="Modal1" runat="server"
TargetControlID="HiddenForModal" PopupControlID="PopupPanel" />
In your message handler in code-behind, you'll show the ModalPopupExtender:
Modal1.Show();
And in the code you're using to dismiss the Modal, call the ModalPopupExtender's Hide function:
Modal1.Hide();
I use this method for showing a modal that displays detailed data that I retrieve from a database based on what's selected in a GridView.