By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,117 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,117 IT Pros & Developers. It's quick & easy.

Refreshing parent page from a child page opened as a modal dialog boxOptions

P: n/a
Default.aspx is the starting page containing a control(ascx) which
has
asp:button control on it. On the button click event it has to open a
new page as a modal control. Since refreshing a page in a dialog box
ended up opening up a new browser window with the aspx page, I read
on
a forum that I should use the iframe control and since I have to open
a bunch of pages as diaogboxes, I created a general
page(Container.aspx) which has an iframe control on it, which I then
pass a parameter(pageToGoTo) specifying the aspx page that has to be
opened as a dialogbox.

Sequence of events and code are as follows:
On the default.aspx page I have added a control with a button. On the
button click server side event on that control, I call an aspx page.
string script = String.Format("window.showModalDialog(\"{0}?
pageToGoTo=testWebForm01.aspx\", \"testWebForm01.aspx
\" ,'dialogWidth=520px;dialogHeight=650px;dialogTop=1 25px;dialogLeft=125px;');*",
ResolveUrl("~/Container.aspx"));
Page.ClientScript.RegisterStartupScript(GetType(),
"test",
script, true);
On the Container.aspx I have an iframe control called frameTest which
I load on Page_Load event as follows
string pageToGoTo =
Request.QueryString["pageToGoTo"];
frameTest.Attributes["src"] = pageToGoTo;
This is then able to load the testWebForm01.aspx in the iframe
control.
Now on a button click event on testWebForm01.aspx I want to close the
testWebForm01 form and reload default.aspx so that the control on
default.aspx. I added the following javascript code to
testWebForm01.aspx
function refreshParent()
{
window.opener.location.href = window.opener.location.href;
if (window.opener.progressWindow)
{
window.opener.progressWindow.close()
}
window.close();
// parent.refresh();
// self.close();
}
and called it on the server side button_click event as follows
string script = "refreshParent()";
Page.ClientScript.RegisterStartupScript(GetType(),
"test",
script, true);
I keep getting window.opener is null error.
I read on another forum that if we have used showModalDialog method
then window.opener method is not initialized.
I did play around with trying to initialize it but haven't had any
success.
Does anybody have any idea on how refreshing the parent page can be
accomplished? Please let me know.
Thanks
Sumeet
Oct 31 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.