Re: cause webpage one to reload when webpage two is closed.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi just had one last question. Not sure if there is anything that can be
done about this but when webpage 2 reloads (I have some controls that
postback) It also causes webpage 1 to reload. Is there anyway to have page
one reload only when page two is closed? I guess the onunload event must
occure when page 2 postsback to the server? Thanks.
HtmlGenericControl body =

(HtmlGenericControl)Master.FindControl("MasterPageBodyTag");
body.Attributes.Add("onunload",
"opener.location.href=opener.location.href;");
--
Paul G
Software engineer.


"Alexey Smirnov" wrote:

On Jun 17, 11:25 pm, Paul <P...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi, It works! I guess it must know what the parent window is to be able to
reload it.
Thanks!
--
Paul G
Software engineer.



"Alexey Smirnov" wrote:
On Jun 17, 10:28 pm, Paul <P...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi, thanks for the response.
I tried adding
<body onunload="opener.location.href=opener.location.href;"></body>
to the source of the second page but get the error
element body can not be nested within element td. I placed the code as
follows in the second form aspx file.

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">

<body onunload="opener.location.href=opener.location.href;"></body>

followed by several html tables.
Anyhow just wondering where to place the body tag?

Also the way the user gets to the second page from the first page is just a
hyperlink.
thanks.

--
Paul G
Software engineer.

"Alexey Smirnov" wrote:
On Jun 17, 9:19 pm, Paul <P...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi I tried a google search but could not find anything. I am trying to cause
one webpage to reload when a second web page is closed. The second webpage
loads data into a session variable and when closed I need to reload the first
page loading in the data from the session variable. Since I need to close
the sescond form just setting the post back url to the first page on the
close button from the second page is not quite what I am looking for.
--
Paul G
Software engineer.

Hi Paul,

Try to add the following code to your second web page

<body onunload="opener.location.href=opener.location.href;">

You might be also interested to see the following thread
http://forums.asp.net/t/988319.aspx

Hope this helps- Hide quoted text -

- Show quoted text -

The BODY element contains all the content of a document, including TD
and TABLE. It can be nested within HTML element only. It seems that
you are using Master page and it means you should change a BODY
element of the Master page. If Master page is used for many Content
pages then you can either make a copy of it (to apply changes to the
BODY tag), or you can set your Master page body tag to:

<body id="mBody" runat="server">

Then add this on the page that has to be closed:

public void Page_Load(Object sender, EventArgs e)
{
HtmlGenericControl body =
(HtmlGenericControl)Master.FindControl("mBody");
body.Attributes.Add("onunload",
"opener.location.href=opener.location.href;");
}

I didn't test it, but I think it should work.- Hide quoted text -

- Show quoted text -

Great! :-)

.



Relevant Pages

  • Re: cause webpage one to reload when webpage two is closed.
    ... Paul G ... Software engineer. ... one webpage to reload when a second web page is closed. ... you are using Master page and it means you should change a BODY ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: cause webpage one to reload when webpage two is closed.
    ... Paul G ... Software engineer. ... one webpage to reload when a second web page is closed. ... you are using Master page and it means you should change a BODY ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: cause webpage one to reload when webpage two is closed.
    ... postback) It also causes webpage 1 to reload. ... Software engineer. ... you are using Master page and it means you should change a BODY ...
    (microsoft.public.dotnet.framework.aspnet)
  • howto: please wait, this may take a few seconds...
    ... what if i have a webpage that displays the text "please wait, ... but once this event has happened, i want the webpage to reload ... and display a different message, ... waiting for actually occured, i want the webpage to actually visibly ...
    (comp.lang.php)
  • Re: unable to load page on first time
    ... Poor internet connection, ... It often happens with the advertisement section of ... the webpage, to check my Internet connection, or reload. ... the page almost always fixes the problem if it's the main webpage. ...
    (alt.os.windows-xp)