Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Window.Close Opens New Annoying Window

Reply
Thread Tools

Window.Close Opens New Annoying Window

 
 
Vijay Kerji
Guest
Posts: n/a
 
      12-01-2004
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:w indow.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
 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      12-01-2004
"Vijay Kerji" <> wrote in message
news: om...

> 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.


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      12-01-2004
Vijay,

Try putting a line

<base target=_self>

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

Eliyahu

"Vijay Kerji" <> wrote in message
news: om...
> 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:w indow.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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Postback in Popup Window Opens a New Browser Amir Shaz ASP .Net 5 08-31-2012 07:20 AM
How to close a parent modal window when child modal window opens? gopal srinivasan Javascript 0 11-05-2004 05:59 AM
Buttons Opens a new window netnews.comcast.net ASP .Net 4 01-13-2004 05:47 AM
Button click on Web Dialog opens its copy in new window robertm ASP .Net 1 08-11-2003 05:57 PM
window.open opens a full window in Netscape4 !!! kiran Javascript 4 07-24-2003 04:06 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57