473,756 Members | 6,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

refreshing parent window on closing of child window

8 New Member
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 5486
semomaniz
210 Recognized Expert New Member
Please read
http://bytes.com/topic/asp-net/answe...-opened-window
Dec 17 '09 #2
Frinavale
9,735 Recognized Expert Moderator Expert
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 Recognized Expert Moderator Expert
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
1831
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 that a link within a "parent" window has opened a new browser window.
2
2446
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 window closes, the child closes too. Is there a way to keep the child window open? Yes keep it orphaned. -- John Dalberg
2
23510
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 window to open a child window thru javascript window.open 2) I have some functionality in the child window that changes the data
4
4257
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 some operation . Once the operation is done, i have to close the child window, and refresh the parent window automatically. I am able to close the child window automatically , But not able to refresh the parent window.
10
4029
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 application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
1
1739
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 = window.open('http://www.thescripts.com'); how to use "win" to keep refreshing thescript.com Thanks
2
2179
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 close the parent window without closing the child window. please reply me. if there is any solution for this....
3
4966
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 language="JavaScript"> function closeAndRefresh() { window.opener.location.href="#{facesContext.externalContext.requestContextPath}/main/billing/billRecords.jsf";
4
3983
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 the first child window closes after opening the second child. This is the second time I am typing the post, I lost all content because the site complaine I was using the lesser than symbol.
3
9164
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: ------------------------ For opening modal window from parent window: showModalDialog("mypage.jsp",window,"dialogHeight:480px;dialogWidth:700px;");
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9904
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9735
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.