• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 363
  • 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
 
Samuel LiewCommented:
if you mean as in a query string, just add it to the url:
window.opener.location="page3.aspx?id=123'
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
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
 
Samuel LiewCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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