How Do I pass a parameter back to the parent page from child page when I refresh parent page

I've read for two days solutions for the following question and tried dozens of solutions offered but none worked.So here's the problem.I am writing a ASP.NET application using CodeCharge  Studio.I have a .aspx page from where I do open a chile page with the following code:on the onclick event of the link I run   openwindow1();return true; where openwindow1() is in the HTML of the page and looks like this
       <script language="JavaScript1.2">
function openwindow1()
{
        window.open("http://localhost/NewProject98/Edit_Agency.aspx","mywindow","menubar=0,resizable=1,width=720,height=720");
}
</script>

Everything's good so far.
On the child window (Edit_Agency.aspx) I have a record form where user enters data and after the submit button is pushed the child window is closed and the parent is refreshed but unfortunately on the refresh I loose the variable I need to display the correct data.What I mean by this is when parent is loaded  from a different page an SQL query is run based on session variable varID1 and a single record is displayed.When I use refresh from the child that variable is gone and all records are displayed.However on the child page I do have the control which holds the right value I need to pass bachk to parent to run correct query.Child page code:
function refreshParent() {

window.opener.location.href = 'Agent_Details_Agency.aspx';

 if (window.opener.progressWindow)                
 {
  window.opener.progressWindow.close()
}
window.close();
}
</script>

My question here is if there is any way to do something like this in the code :
replace window.opener.location.href = 'Agent_Details_Agency.aspx'; with
window.opener.location.href = 'Agent_Details_Agency.aspx?varID1= ???????'
where the ??????? represents the code or syntax I need to use to refresh the parent page and pass the varID1= value (which I have in a textbx in the child form).I don't know if I was explicit enough I hope yes.
Any help would be greatly appreciated.

Latzi_MarianSystems IntegratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ashish PatelCommented:
i suggest Dont do a href rather submit the parent page after setting the variable to some hidden field of the parent page.

function refreshParent() {

 if (window.opener.progressWindow)                
 {
  window.opener.progressWindow.close()
}
window.opener.document.forms[0].action = 'Agent_Details_Agency.aspx';
window.opener.document.forms[0].submit();
window.close();
}
</script>

please change teh forms[0] with the form name of the parent page. Also before the submit, i guess the variable is already set in the hidden field or any control field of parent form, so on the parent form, just get that value by saying request.form("variable") and you will get that value.
araimCommented:
well... this can be done exactly as you describe ;)
before window.close() add
window.opener.location.href = 'Agent_Details_Agency.aspx?varID1= ' + document.getElementById('some_id').value;

where some_id is an id of text field in your popup.
Latzi_MarianSystems IntegratorAuthor Commented:
Thanx for the warp speed reply.I've tried araim's solution and I am almost there however this time when I push submit on the child page I do close the child and passthe parameter to the parent (in explorer address bar I have http://localhost/NewProject98/Agent_Details_Agency.aspx?varID1=3 which is perfect but it looks like the page doesn't refresh.I still have to push the refresh button on explorer to get the grid populated with the record corresponding to varID1=3.
So my code this time look like :
<script language="JavaScript">
function refreshParent() {
 
window.opener.location.href = 'Agent_Details_Agency.aspx?varID1=' + document.getElementById('Real_Estate_Agency1TextBox1').value;
 
// if (window.opener.progressWindow)
               
 //{
  //  window.opener.progressWindow.close()
  //}
  //window.close();
}

</script>

If I use
window.opener.location.href = 'Agent_Details_Agency.aspx' then the page refreshes but as I said because I loose varID1 I have the grid populated with hundredhs of records which is no good.Any Ideea what can be wrong??
I will also look into what asvforce said as well however I did look into araims solution as that one was closer to what I thought I should use .Any help greatly appreciated I really ahve to solve this tonight it is 11.30 p.m. already and I am still nowhere with it so I keep trying.Thank you again guys.
Ensure Business Longevity with As-A-Service

Using the as-a-service approach for your business model allows you to grow your revenue stream with new practice areas, without forcing you to part ways with existing clients just because they don’t fit the mold of your new service offerings.

araimCommented:
you may try to force refresh :

window.opener.location.href = 'Agent_Details_Agency.aspx?varID1=' + document.getElementById('Real_Estate_Agency1TextBox1').value;

window.opener.location.reload(true);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Latzi_MarianSystems IntegratorAuthor Commented:
Shall I delay the refreshParent function execution ?
Latzi_MarianSystems IntegratorAuthor Commented:
Perfect. Problem solved once and forever.Thank you for your help araim .This place(experts exchange) I signed up tonight it's simply perfect.Thank you again
Latzi_MarianSystems IntegratorAuthor Commented:
Sorry I've accepted a solution as a complete solution but actually I just saw after a few tests that the parent reloads only if I click the submit button twice and the child doesn't close anymore.However it worked the first time I tried your last suggestion by adding window.opener.location.reload(true);
Since then I still try to do something with it it's still not 100%
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.