Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have simple project(master page).
This is my deafult.aspx
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
   

    <script src="popup_js/jquery.min.js" type="text/javascript"></script>
   <script src="popup_js/jquery-ui.min.js" type="text/javascript"></script>
    <link href="popup_js/jquery-ui.css" rel="stylesheet" type="text/css" />    

      <script type="text/javascript">
          var $dialog 

        function btnOpenDialog_onclick() {
       
                  var page = "pop.Aspx?ID=-1"; 

                  $dialog = $('<div></div>')
                .html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%"></iframe>')
                .dialog({
                    autoOpen: false,
                    modal: true,
                    height: 200,
                    width: 400,
                    title: "Show Pop.Aspx",

                    close: function (event, ui) {

                        alert("closed");
                    }
                });
                $dialog.dialog('open');


            }

          
    </script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    
  
        <input id="btnOpenDialog" type="button" value="Open" onclick="return btnOpenDialog_onclick()" />
    
</asp:Content>

and this is my pop.aspx
<pre lang="xml">  <script language="javascript" type="text/javascript">

        function btnClose_onclick() {

          window.parent.jQuery('#dialog').dialog('close');
      }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>

      bla<br />
        bla<br />
        bla<br />
&nbsp;<input id="btnClose" type="button" value="Close"   /></div>
    </form>
</body>
</pre>

This close event dosent work.How do I?
I know jquery buttons(close). I want my button or another event close dialog box or trig close event.
Posted

1 solution

I think you forgot to add the Id "dialog" to the dialog div while you create. Add that.

Because you are trying to select that using "#dialog".
 
Share this answer
 
Comments
akalyoncu 18-Oct-15 9:46am    
I tried this and like it a lot. Do you have a solution please have tried?
So it works?
akalyoncu 18-Oct-15 11:15am    
1. modify : $dialog = $('<div id="dialog"></div>') result:dosent work
2.modify: $dialog = $( "#javascript:void(0)dialog" ) reuslt:dosent work
Then debug the code and on the developer console, find out why it is not selecting the dialog while close is called.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900