Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 refreshing a parent page after closing child page

Author  Topic 

salmonraju
Yak Posting Veteran

54 Posts

Posted - 2007-07-12 : 04:54:41
hi,

I am facing a problem with window.showModalDialog() when working with parent child pages in asp, my problem is ,i am unable to get the values that set on the child page to parent page
the scenerio is
(Parent page)
parent.aspx --contains a button say ShowChildBtn,
a label MessageFromChildLabel

------------------------------------------
in the button click I wrote the following code

protected void ShowChildBtn_Click(object sender, EventArgs e)
{
session["Var1"]="Page 1";
string script = "<script


language=\"JavaScript\">window.showModalDialog('Child.aspx');</script>";
Page.RegisterStartupScript("tempscript",script);
}

page_load of parent contains

if(session["Var2"]!=null)
{
MessageFromChildLabel.Text=session["Var2"].tostring();
}


Child.aspx --contains a button say ReturnToParentBtn,a label

MessageFromParentLabel
---------------------------------------------------
in the button click I wrote the following code

protected void ReturnToParentBtn_Click(object sender, EventArgs e)
{
MessageFromParentLabel.Text=session["Var1"].tostring();
session["Var2"]="Child Page";
string script = "<script
language=\"JavaScript\">window.close();</script>";
Page.RegisterStartupScript("tempscript",script);
}

when iam running the application clicking the ShowChildBtn in parent.aspx child window is getting popup with label containing "Page 1";

when i am clicking ReturnToParentBtn session["Var2"] is storing a value and returning to parent.aspx

my PROBLEM IS HERE I WANT TO REFRESH THE PAGE AUTOMATICALLY,
SO THAT THE MessageFromChildLabel DISPLAYS A VALUE WITHOUt
manually refreshing the page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-12 : 06:19:29
use window.opener.reload.reload()


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -