Hi i have a problem launching my dynamic modal popup. I need to launch it by clicking on a button this button must transfer a value to a web service that retrieve from the database some data.
Here is the code of the button
<asp:Button ID="btnShow" Text="Details" runat="server" />
Here the code of the modal popup
<asp:ModalPopupExtender ID="btnShow_ModalPopupExtender" runat="server"
TargetControlID="btnShow" OkControlID="btnDlgOK" PopupControlID="pnlPopup"
DynamicControlID="lblInfo"
DynamicServicePath="GetDetails.asmx"
DynamicServiceMethod="GetData"
BackgroundCssClass="modal"
DropShadow="true"
>
</asp:ModalPopupExtender>
And here my basic javascript to open the popup
<script type="text/javascript">
function showpop() {
$find("btnShow_ModalPopupExtender").show();
}
</script>
Now I don't know how to call javascript code from the button and also how to call the web service that extract the data from the database.
How can I do it?
Attach a click
event on the button to display the popup window
<script type="text/javascript">
jQuery(function(){
jQuery("#btnShow_ModalPopupExtender").hide(); // hide when page started
jQuery("#btnShow").click(function(){
jQuery("#btnShow_ModalPopupExtender").show();
});
});
</script>
Make this simple with jQuery UI modal dialog. You can easily do whatever you need.
There are lots of events available for handling the ajax call before you show modal dialog.