I have a parent page and child page, both aspx. All is working, but now I would like to close child page, if user leaves child popup page and goes back to parent page and clicks on something else like page index of Gridview. I CANNOT close popup child page
if user goes to another app, or some other location, I only want to close if something on parent page is changed.
I have the PageIndexChange Event set up for other purposes, I would just like to add some functionality, perhaps a script manager to close the child popup page if the Gridview index is changed, java or another way which ever works best.
Any help and examples would be greatly appreciated.
Sorry, this does not apply at all to what I am trying to do.
First, in order to open the child popup, it must be intitiated by clicking the edit link of a gridview.
My desire was to close the child window say if the user went back to the parent page and clicked on anything other than the update or cancel link, both of which already need to close the child popup. Like if they were to click Edit in the Gridview on another
record, or tried to click on another page index.
Contributor
2155 Points
2142 Posts
close child aspx page if gridview index is changed on parent page.
Nov 17, 2011 03:00 PM|march11|LINK
Hi all,
I have a parent page and child page, both aspx. All is working, but now I would like to close child page, if user leaves child popup page and goes back to parent page and clicks on something else like page index of Gridview. I CANNOT close popup child page if user goes to another app, or some other location, I only want to close if something on parent page is changed.
I have the PageIndexChange Event set up for other purposes, I would just like to add some functionality, perhaps a script manager to close the child popup page if the Gridview index is changed, java or another way which ever works best.
Any help and examples would be greatly appreciated.
Thanks,
All-Star
39821 Points
4269 Posts
Re: close child aspx page if gridview index is changed on parent page.
Nov 21, 2011 04:27 AM|Song-Tian - MSFT|LINK
Hi,
Somewhere at the top of your script in your main document you include a line:var children=Array();
Now whenever you want to open a new childwindow make sure you use a line similar to:
children[children.length]=etc..
You can then have one function such as:
function closeAllChildren()
{
for(var n=0;n<children.length;n++)
{children[n].close();
}
window.close();
}
Each child document just needs a button to call this function as follows.
<input type="button" onclick="window.opener.closeAllChildren()">
Feedback to us
Contributor
2155 Points
2142 Posts
Re: close child aspx page if gridview index is changed on parent page.
Nov 21, 2011 08:02 AM|march11|LINK
Sorry, this does not apply at all to what I am trying to do.
First, in order to open the child popup, it must be intitiated by clicking the edit link of a gridview.
My desire was to close the child window say if the user went back to the parent page and clicked on anything other than the update or cancel link, both of which already need to close the child popup. Like if they were to click Edit in the Gridview on another record, or tried to click on another page index.