There is such code asp.net webforms.

<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript" src="Scripts/jquery-1.10.2.js"></script> <script type="text/javascript" src="Scripts/jquery-ui.min.js"></script> <link href="Scripts/jquery-ui.css" rel="stylesheet" type="text/css"/> </head> <body> <form id="form1" runat="server"> <div> <div id="popup" style="display:none" title="Bla"> <asp:GridView ID="GridView1" runat="server"></asp:GridView> </div> <asp:Button ID="Button1" runat="server" Text="Button" /> </div> </form> <script type="text/javascript"> $('#Button1').click(function () { $('#popup').dialog({ Width: 600 }); }); </script> </body> </html> 

Why does the window appear and immediately disappear when I press the button? How can it be done so that it does not disappear?

    1 answer 1

    I checked your code in myself - everything is ok, the window does not close. If it is closed, you can directly specify display:block for #popup when you press the button?

     <script type="text/javascript"> $('#Button1').click(function () { $('#popup').css('display', 'block') $('#popup').dialog({ Width: 600 }); }); </script> 

    PS used libraries with google, maybe in them?

     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">