Thursday, March 29, 2012

passing values from chil pop up to parent

Hello Everyone,
I am trying to pass the value from my child window to my parent window. I
don't get the value from child to my parent when I refresh my parent page,
if I don't refresh my parent page then I get the value frtom my child window
.
Below is the code in my parent window and child page. I need to refresh my
parent page because once the page refreshes and the child window closes, I
want some method to execute
btnSubmit.Attributes.Add("onclick", "window.open('newForm.aspx' ,
'CustomPopUp','width=600, height=400, statusbar=no, menubar=no,
resizable=no') ");
txtName.Text = hdnPopResult.Value; // assigning hidden filed value to a text
filed on asp.net page
my child window
function passvalues()
{
var txtValue = document.getElementById("txtSubmit").value;if(txtValue !="")
{
window.opener.form1.hdnPopResult.value = txtValue;
opener.document.location.reload();
window.close();
}
}
btnSubmit.Attributes.Add("onclick", "passvalues()");
Any help will be apprecaited."Vinki" <Vinki@.discussions.microsoft.com> wrote in message
news:93A10F20-93D0-438B-9BC7-C012DEBAB555@.microsoft.com...

> I am trying to pass the value from my child window to my parent window. I
> don't get the value from child to my parent when I refresh my parent
> page,
> if I don't refresh my parent page then I get the value frtom my child
> window.
That's normal behaviour - think about it...
When you tell a page to reload, that's exactly what it will do i.e. it will
load in precisely the way that it loaded previously - it won't "remember"
the fact that it has been changed client-side *after* it was last loaded...

> I need to refresh my parent page because once the page refreshes and the
> child window closes, I want some method to execute
Is this method client-side or server-side?
Mark Rae
ASP.NET MVP
http://www.markrae.net
you should submit the parent instead of reload.:
window.opener.form1.hdnPopResult.value = txtValue;
window.opener.form1.submit();
-- bruce (sqlwork.com)
Vinki wrote:
> Hello Everyone,
> I am trying to pass the value from my child window to my parent window.
I
> don't get the value from child to my parent when I refresh my parent page
,
> if I don't refresh my parent page then I get the value frtom my child wind
ow.
> Below is the code in my parent window and child page. I need to refresh my
> parent page because once the page refreshes and the child window closes, I
> want some method to execute
> btnSubmit.Attributes.Add("onclick", "window.open('newForm.aspx' ,
> 'CustomPopUp','width=600, height=400, statusbar=no, menubar=no,
> resizable=no') ");
> txtName.Text = hdnPopResult.Value; // assigning hidden filed value to a te
xt
> filed on asp.net page
> my child window
> function passvalues()
> {
> var txtValue = document.getElementById("txtSubmit").value;if(txtValue !=""
)
> {
> window.opener.form1.hdnPopResult.value = txtValue;
> opener.document.location.reload();
> window.close();
>
> }
>
>
> }
> btnSubmit.Attributes.Add("onclick", "passvalues()");
> Any help will be apprecaited.
>
>
It is a server side code.
"Mark Rae [MVP]" wrote:

> "Vinki" <Vinki@.discussions.microsoft.com> wrote in message
> news:93A10F20-93D0-438B-9BC7-C012DEBAB555@.microsoft.com...
>
> That's normal behaviour - think about it...
> When you tell a page to reload, that's exactly what it will do i.e. it wil
l
> load in precisely the way that it loaded previously - it won't "remember"
> the fact that it has been changed client-side *after* it was last loaded..
.
>
> Is this method client-side or server-side?
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
>
"Vinki" <Vinki@.discussions.microsoft.com> wrote in message
news:EA7EA873-2502-48F0-A12A-A826F6854E4A@.microsoft.com...

> It is a server side code.
Bruce has already given you the correct answer...
Mark Rae
ASP.NET MVP
http://www.markrae.net

0 comments:

Post a Comment