Jquery模态弹出结束 [英] Jquery modal popup closing

查看:49
本文介绍了Jquery模态弹出结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个jQuery模式弹出窗口,我点击按钮点击c#代码。

我无法关闭后面的代码甚至是javascript 。

我希望能够从锚标签或asp:Button关闭它。尝试了很多方法都没有用。



Javascript:

Hi all,
I have a jQuery modal popup, which i open from c# code on button click.
I can't close from code behind or even javascript.
I want to be able to close it from anchor tag or asp:Button. Tried a lot of ways didn't work.

Javascript:

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>




<script type="text/javascript">
        function showmodalpopup() {
            debugger;
            $("#popupdiv").dialog({
                title: "Registration",
                width: 650,
                height: 450,
                modal: true,
                buttons: {
                    "close": function () {
                        $("#popupdiv").dialog('close');
                    }
                }
                //autoOpen: false,
                //show: 'fade',
                //hide: 'fade',
                //resizable: false
            });            
            //function closeDialog() {
            //    $(this).find("#popupdiv").dialog("close");
            //}
        };
        </script>





HtML:



HtML:

<div id="main">
   <div id="popupdiv" title="Basic modal dialog" style="display: none">
       <p>There is already a Master account holder associated with this account.<br />Do you want to request to be added as an additional user on the account?</p>
       <div class="span3" ><a href="#" id="showrole" style="text-align:center;color:#fff;background-color:#10466E;padding:5px;">Yes</a></div>
       <div class="span3"><a href="#" id="hidepopup" style="text-align:center;color:#fff;background-color:#10466E;padding:5px;" class="hidepop">No</a>
          <%-- <button type="button" id="closepopup">No</button>
           <asp:Button runat="server" ID="btnClose" Text="close" OnClientClick="closeDialog();"/>--%>
       </div>
       <div class="span4" id="role_div" style="display: none; margin-removed 10px;">
           Please choose a role
           <div class="controls">
               <asp:DropDownList runat="server" ID="Roles_drp" ValidationGroup="newuserGroupValidation">
                   <asp:ListItem Selected="true" Value="0">Please Choose</asp:ListItem>
                   <asp:ListItem>Admin</asp:ListItem>
                   <asp:ListItem>Installer</asp:ListItem>
                   <asp:ListItem>Sales</asp:ListItem>
               </asp:DropDownList><br />
               <asp:RequiredFieldValidator runat="server" ID="drpValidator" ControlToValidate="Roles_drp" ErrorMessage="Please select a role" ForeColor="Red" Display="Dynamic" SetFocusOnError="true" InitialValue="0" ValidationGroup="newuserGroupValidation"></asp:RequiredFieldValidator>
           </div>
       </div>
   </div></div>





c#打开弹出窗口的代码:



c# code to open the popup:

ScriptManager.RegisterStartupScript(this, GetType(), "Show Modal Popup", "showmodalpopup();", true); //to show the jQuery popup with the required info.





请告知我的代码有什么问题,以便模态弹出窗口不关闭。

谢谢



Please advise by showing what's wrong with my code so that the modal popup not closing.
Thank you

推荐答案

#popupdiv)。dialog({
title : 注册
宽度: 650
身高: 450
modal: true
按钮:{
close function (){
("#popupdiv").dialog({ title: "Registration", width: 650, height: 450, modal: true, buttons: { "close": function () {


#popupdiv )。二alog(' close');
}
}
// autoOpen:false,
// show:'fade',
// 隐藏:'淡出',
// resizable:false
});
// function closeDialog(){
//
("#popupdiv").dialog('close'); } } //autoOpen: false, //show: 'fade', //hide: 'fade', //resizable: false }); //function closeDialog() { //


(this).find(#popupdiv)。dialog(close);
// }
};
< / script>
(this).find("#popupdiv").dialog("close"); //} }; </script>





HtML:



HtML:

<div id="main">
   <div id="popupdiv" title="Basic modal dialog" style="display: none">
       <p>There is already a Master account holder associated with this account.<br />Do you want to request to be added as an additional user on the account?</p>
       <div class="span3" ><a href="#" id="showrole" style="text-align:center;color:#fff;background-color:#10466E;padding:5px;">Yes</a></div>
       <div class="span3"><a href="#" id="hidepopup" style="text-align:center;color:#fff;background-color:#10466E;padding:5px;" class="hidepop">No</a>
          <%-- <button type="button" id="closepopup">No</button>
           <asp:Button runat="server" ID="btnClose" Text="close" OnClientClick="closeDialog();"/>--%>
       </div>
       <div class="span4" id="role_div" style="display: none; margin-removed 10px;">
           Please choose a role
           <div class="controls">
               <asp:DropDownList runat="server" ID="Roles_drp" ValidationGroup="newuserGroupValidation">
                   <asp:ListItem Selected="true" Value="0">Please Choose</asp:ListItem>
                   <asp:ListItem>Admin</asp:ListItem>
                   <asp:ListItem>Installer</asp:ListItem>
                   <asp:ListItem>Sales</asp:ListItem>
               </asp:DropDownList><br />
               <asp:RequiredFieldValidator runat="server" ID="drpValidator" ControlToValidate="Roles_drp" ErrorMessage="Please select a role" ForeColor="Red" Display="Dynamic" SetFocusOnError="true" InitialValue="0" ValidationGroup="newuserGroupValidation"></asp:RequiredFieldValidator>
           </div>
       </div>
   </div></div>





c#打开弹出窗口的代码:



c# code to open the popup:

ScriptManager.RegisterStartupScript(this, GetType(), "Show Modal Popup", "showmodalpopup();", true); //to show the jQuery popup with the required info.





请告知我的代码有什么问题,以便模态弹出窗口不关闭。

谢谢



Please advise by showing what's wrong with my code so that the modal popup not closing.
Thank you


这篇关于Jquery模态弹出结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆