Values Sent from Pop-up to Parent Gets Lost...

L

linushung

I'm trying to use a pop-up page to accept user input then send those
values to the parent page to rebind a gridview control, here's the
scenario:

Parent:

<script type="text/javascript">
function OpenWindow()
{
window.open("child.aspx", "Child",
"menubar=0,resizable=0,width=350,height=250,toolbars=0");
}
function UpdateValues(pValue)
{
document.getElementById('txtValue').value=pValue;
}
</script>

<html>
<body>
...
...
<asp:ImageButton ID="imgSearch" runat="server"
OnClientClick="OpenWindow()" PostBackUrl="javascript:return false;" />
<asp:TextBox id="txtEndDate" runat="server"
EnableViewState="true"></asp:TextBox

(notice that I have disabled postback on the image button by using
"javascript:return false;")


Child:

<script type="text/javascript">
function ReturnValues()
{
window.opener.UpdateValues(3);
window.opener.location='default.aspx';
}
</script>

<html>
<body>
...
...
<asp:Button ID="btnOK" runat="server" Text="OK"
OnClientClick="ReturnValues()" />

I then put a breakpoing on the 1st line of the parent page Page_Load()
event. When the breakpoint stops, I can see the textbox on the parent
page has the value 3, but I can't see the same value from the local
variable window. Also, after pressing F5 and the page loads, value 3 in
the textbox is wiped out.

Can anyone here tell me what's going on?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top