Solved

Closing pop up window and pass the selected data back to parent page

Posted on 2003-12-10
5
1,140 Views
Last Modified: 2012-05-04
I now v a parent page that will pop up a window when user clicks a command button. The pop up page allows user to select some data and when user click select these command button, all the selected data will display on the parent screen.. I just need 2 know the way 2 close the pop up window and the parent page will automatically display the selected data from the pop up window...

Thanks
0
Comment
Question by:adomsg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 2

Author Comment

by:adomsg
ID: 9918410
I am using ASP.NET and VB.NET
0
 
LVL 15

Expert Comment

by:OMC2000
ID: 9918734
When your popup form selection is submitted you could either directly update parent form elements or (if selection causes many updates in a parent form) submit popup form, save selection in database and return to this popup javascript directive to submit parent form (or just reload) in order to let it re-read data from DB and close popup window.

1.
function onSelection()
{
  opener.document.forms[0].somefields.value = window.document.forms[0].myselection.value;
  window.close();
}

2.

function onLoad()
{
  opener.document.forms[0].submit();
// or opener.location.href = opener.location.href;
  window.close();
}
0
 
LVL 2

Author Comment

by:adomsg
ID: 9918894
when do i call these functions?? And where do i put them
0
 
LVL 15

Accepted Solution

by:
OMC2000 earned 200 total points
ID: 9918925
direct changes in parent from popup:
1.1
<form ...>

<input type=button onclick="onSelection()">
</form>

1.2
<form ...>

<select myselection onchange="onSelection()">
</select>
</form>

2. refresh parent form after popup submit
<body onload="onLoad()">
</body>
0
 
LVL 6

Expert Comment

by:jyotisinha
ID: 9920404
adomsg,

I think if you use HTML button control instead of ASP server button control to popup new window it won't cause any server side postback. then popup page like follows -

<INPUT class="expButton" id="btnpopNewWin" onclick="javascript:window.open('frmpopNewwin.aspx,'POPUP','width=500,height=600,screenX=900,screenY=800,left=500,top=100')"type="button" value="Select" Height="22" Width="81">

where POPUP ="SesVar" will be some page scope string variable to be used as session variable name in parent page

in Child popup window while submitting the information put the info in local array and then
Session.Add("SesVar", arrOfPopChilddata)

now you can easily access the data using session variable POPUP as session(POPUP).

I think it'll work for you .... isn't it ?

Jyoti.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question