Click here to Skip to main content
11,579,291 members (70,318 online)
Rate this: bad
good
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 0:20am
Comments
Dec90 at 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
0 Frankie-C 170
1 OriginalGriff 163
2 Afzaal Ahmad Zeeshan 85
3 Richard Deeming 60
4 Suvendu Shekhar Giri 60
0 OriginalGriff 1,003
1 Sergey Alexandrovich Kryukov 750
2 Abhinav S 583
3 F-ES Sitecore 420
4 Dave Kreskowiak 419


Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 26 Feb 2013
Copyright © CodeProject, 1999-2015
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