Close JQuery UI dialog from click event of button placed inside the page opened in dialog
in Using jQuery UI
•
11 years ago
I am calling jquery UI dialog, and opening a new .aspx page inside it:
protected void Button1_Click(object sender, EventArgs e)
{
string strURL = "http://localhost:3907/JQueryUI/PopupASPXPageTestingJQueryUI.aspx";
string script = "<script language=\"JavaScript\"> "+
"var url = '"+ strURL +"'; " +
"var mydialog = $(' <div id=\"mydiv\" align=\"left\" style=\"width: 600px; height: 800px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;\"> <iframe id=\"myframe\" src=\"' + url + '\" frameborder=\"0\" width=\"100%\" height=\"100%\"></iframe> </div> ').appendTo('body'); " +
"mydialog.dialog({ resizable: false, draggable: false, height: 800, width: 600, zIndex: 3999 , closeOnEscape:false, modal: true, open: function (type, data) { $(this).parent().appendTo(\"form\"); } }); " +
"</script>";
Page.RegisterStartupScript("tempscript",script);
}
Now, I want to close this dialog, from a button click on code behind of the .aspx page opened in this dialog.
For Example,
protected void btn1_Click(object sender, EventArgs e)
{
string script = "<script language=\"JavaScript\"> " +
"$(mydialog).dialog('close');" +
"</script>";
Page.RegisterStartupScript("tempscript12", script);
}
But, it is not working. I have tried several other ways, but none is working. Please, help me.
3