Window.Close Opens New Annoying Window

V

Vijay Kerji

Hi,
Please go through the following scenario.
1)On Button click, Parent window opens a child window using
showModalDialog
2)Button is a server control and showModalDialog script is registered
using the following code:

string scriptblock = "<script language='javascript'>returnValue =
window.showModalDialog('Datagrid1.aspx', 'xxx');" +
"if(returnValue == 0) window.open('Webform1.aspx', '_self'); else
window.open('Datagrid1.aspx', '_self'); </script>";
Page.RegisterStartupScript("Launch_Report_Window",scriptblock);

3)In the Child window there is a SAVE server button control and the
following
code is added in PageLoad for the button:
Button_Save.Attributes.Add("onclick","javascript:window.returnValue
= 0;window.close();");

4)When OnSave button is clicked, a new child window is getting opened
though the modal window is closed, which is annoying.

Any intelligent guess/suggestoins are appreciated.

Thanks


Vijay K Kerji
 
M

Mark Rae

Any intelligent guess/suggestoins are appreciated.

Postback of a modalDialog will post back to a new window unless you
encapsulate the entire code in an <iframe> tag.
 
E

Eliyahu Goldin

Vijay,

Try putting a line

<base target=_self>

in the <Head> section of the page shown in the modal window.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top