Click here to Skip to main content
12,625,239 members (40,834 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
I am trying to achieve following.
1. A link on a parent page will open a new child pop-up.
2. In child pop-up, user enters some data and click save.
3. A data will be saved to databse and pop-up would be closed. A main parent window would be refreshed and conetents entered in a child pop-up would be displayed on a parent page.

I tried following:
btnClose.Attributes.Add("onclick", "javascript:opener.location.reload(true);self.close();");

Problem is when I click the close button of popup window, it asks whether to resend or cancel the request to parent page. Which i want to avoid.

Any solution?

Thanks in avance
Posted 22-Feb-13 1:20am
Comments
Dec90 22-Feb-13 6:23am
   
try opener.location = opener.location instead as I think that will create a new request rather then post the form again.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try this 1,
btnClose.Attributes.Add("onclick", "javascript:opener.location.reload(false);self.close();");
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

I added the following in parent page which will be called when the popup window is closed, which in turn populates the grid with the data added from the popup window

<asp:button id="btnHidden" runat="Server" style="display:none" onclick="btnHidden_Click" xmlns:asp="#unknown" />

Javascript code in popup window
function RefreshParent() {
           window.opener.document.getElementById('cphPage_btnHidden').click();
           window.close();
       }

this solves all my problem
  Permalink  

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 | Mobile
Web02 | 2.8.161128.1 | Last Updated 26 Feb 2013
Copyright © CodeProject, 1999-2016
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