weixin_33738555
weixin_33738555
采纳率0%
2012-09-11 12:46

执行动态模式弹出窗口

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?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • weixin_33743248 weixin_33743248 9年前

    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

    点赞 评论 复制链接分享
  • weixin_33726318 weixin_33726318 9年前

    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>
    
    点赞 评论 复制链接分享

相关推荐