473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

refreshing parent window on closing of child window

8
i have page1.aspx with a grid and ADD button
when i click ADD page2.aspx opens in a new window
when new records an be added

when i save the record it gets added to database as well as page2.aspx closes
wht i need is when page2.aspx closes page1.aspx shld get refeshed and the new added record dispalyed in grid

i have the following code
Expand|Select|Wrap|Line Numbers
  1. Dim strscript As String = "<script language=javascript>refreshandclose();</script>"
  2. If (Not Page.IsStartupScriptRegistered("clientScript")) Then
  3.  Page.RegisterStartupScript("clientScript", strscript)
  4. End If
  5.  
-- now on the html
Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script language='javascripts'>
  3.  function refreshandclose()
  4.  { 
  5.   window.top.parent.location = 'parent.aspx';
  6.   window.setTimeout('window.top.close();', 1000);
  7.  }
  8. </script>
  9. </head>
Dec 17 '09 #1
3 5472
Frinavale
9,735 Expert Mod 8TB
I ran into a few problems with this when using FireFox (version 2).
See my problem and solution in this thread:
http://bytes.com/topic/javascript/an...-window-closed

-Frinny
Dec 17 '09 #3
Frinavale
9,735 Expert Mod 8TB
Svibuk, your script tag is invalid.
It should be:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. </script>
That's not what your problem is.
In fact I'm not really sure what your problem is....

A couple of pieces of advise I can give you is to give your child window a name when you open it...otherwise you're going to have problems accessing the JavaScript method in the parent browser when the child browser closes.

The other thing I recommend is putting an invisible ASP.NET control (like a LinkButton or Button control with the style of display:none) on the page. When you want to refresh the browser use JavaScript to submit the page using the control.

This way you can handle the Button/LinkButton event and in your server side code to refresh the GridView. You know that the page has been submitted because the child browser has been closed because this button is not visible/accessible to the user.

You don't have to submit the page using the ASP.Net control..you could refresh the GridView in your Page Load event every time. This just let's you be more specific.

-Frinny
Dec 17 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: jb61264 | last post by:
Is it possible to refresh a parent browser window when a "child" browser window has been closed using the button in the upper right corner of the browser? When I refer to child window, I mean...
2
by: John Dalberg | last post by:
I have a closed box system which opens an html page. The page closes by the system. I have access to the html page. I added code to open a child window from this page. However when the parent...
2
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
4
by: Sileesh | last post by:
Hi I have a btn in Parent.aspx page . On server_click() of the Btn, i am opening a new window called the child.apsx window. Child window also have a Btn. On serverClick of this Btn, I perform...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
1
by: hashya | last post by:
Hi, I am opening window(child) from current window(parent). Now I want to keep refreshing child window from parent window. How can I achieve this. e.g. var win =...
2
by: javanet | last post by:
Hi all, 1) i opened a parent window. 2) then i opend a child window thruogh this parent window. Now i want to close child window before closing the parend window means my clients can not be...
3
by: Vinutha | last post by:
Hi, I am using javascript to close my child window and after closing child window, i want to refresh parent window. So, this is the script function i am using, <script...
4
by: Buddha | last post by:
Hello, I posted this on two forums, without too much help .. and I am kinda stuck in this. I need to refresh the parent page from the second child window which is opened by the first child and...
3
by: gsuns82 | last post by:
Hi all, I am using modal window for some update purpose, the issue i am facing is,i am not able to refresh parent after closing modal window. The code i used: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.