Click here to Skip to main content
13,254,754 members (51,119 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am having a problem while refreshing my parent window.

I have a webform and I am using a viewstate on this form. on the viewstate's 3rd activeform I have a table. In a row of this table when the radiobutton's value is equal to No(I am doing an autopostback here) a popup window opens. Here on the popup window I make user to select some items in the checkbox list and carry the data to a textbox in the parent form. Till here everything is fine.

My problem is I can not close the popup. What happens is;

I can successfully pass the data to my parent window, refresh it but the popup windows closes and it popups again.

I am trying to do it with this code;

Page.RegisterStartupScript("CLOSE", "<script language="'javascript'">window.opener.document.forms(0).submit();self.close();</script>");

What I also tried;

ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.onunload = CloseWindow();");

Page.RegisterStartupScript("CLOSE", "<script language="'javascript'">window.opener.location.reload();self.close();</script>");

Page.RegisterStartupScript("CLOSE", "<script language="'javascript'">window.opener.location.href = window.opener.location.href;self.close();</script>");

Page.RegisterStartupScript("CLOSE", "<script language="'javascript'">window.opener.history.go(0) = window.opener.location.href;self.close()</script>");
These three doesnt work the way I want. They either popup the popup window again, or close the popup, reload the parent but then parent goes back to Viewstate's active viewindex 1 instead of staying in 3.

Any ideas how can I fix this? Thanks
Posted 6-Apr-11 6:19am
Updated 6-Apr-11 9:08am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

parent goes back to Viewstate's active viewindex 1 instead of staying in 3.= You have to set the active view (ActiveIndex) on each post back.

If you register the script on the page load it will execute on each time postback regardless which view. Use the IsPostback property of the page and necessary conditions to execute the startup script.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 6 Apr 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100