0

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?

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
Sethlans
  • 407
  • 1
  • 5
  • 20

2 Answers2

0

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>
Krishna Kumar
  • 2,101
  • 1
  • 23
  • 34
0

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.

http://jqueryui.com/demos/dialog/#modal-form

Murali Murugesan
  • 22,423
  • 17
  • 73
  • 120