• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

Doable? child page close and parent page open new page

I wonder if this is doable:
I have a master page and default.aspx in on it. There's a hyperlink on it. I click it. Page2.aspx opens. I do whatever. I click submit. Now, instead of refreshing/going back to parent page which is default.aspx...i actually want to load page3.aspx in the master page.

So, instead of having default.aspx when page2.aspx closes, i actually want to load page3.aspx in parent page. Doable?
0
Camillia
Asked:
Camillia
  • 4
  • 3
  • 2
2 Solutions
 
Hube02Commented:
Use: window.opener.location="page3.aspx'
0
 
CamilliaAuthor Commented:
hmmm..how can i pass an id to page3.aspx??
0
 
sam2912Commented:
if you mean as in a query string, just add it to the url:
window.opener.location="page3.aspx?id=123'
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
CamilliaAuthor Commented:
where does thsi window.opener.location go??

So, i have a submit button, goes to submit click event, so when do I call this JS??
0
 
sam2912Commented:
if you want it to activate after you submit the form, put the code in your form onsubmit attribute (which is in the child window)
<form onsubmit="window.opener.location="page3.aspx?id=123'"

Open in new window

0
 
Hube02Commented:
If it were me, I would process the form as normal. These are aspx pages, so I am assuming you are using ASP.NET to process the page. If the page is processed successfully then send the script to redirect the parent page.

<script type="text/javascript">
  window.opener.location = 'page3.aspx?id=123';  // redirect parent window
  window.close();                                                            // close this window
</script>

I do this routinely. For instance, form a has a drop down and next to the drop down there is an add button. This button pops up a new form where the user can add a new whatever. After submitting the form, if it is successful, the script that does the processing calls an ajax function in the parent and closes itself.
0
 
CamilliaAuthor Commented:
how can I NOT hardcode that id=123?? I have that id in my aspx page. How can I get it to the JS?
0
 
Hube02Commented:
That I'm not sure. I use PHP and don't know .NET.

I would do something like:

<script type="text/javascript">
  window.opener.location = 'page3.aspx?id=<?php echo $id; ?>';
  window.close();
</script>


0
 
CamilliaAuthor Commented:
let me see how i can do it in .Net.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now