Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Refreshing parent page from a child page opened as a modal dialog boxOptions

Reply
Thread Tools

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

 
 
Bali
Guest
Posts: n/a
 
      10-31-2008
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refreshing parent page from a child page opened as a modal dialog box Bali Javascript 9 11-04-2008 07:26 PM
Refreshing parent page from a child page opened as a modal dialog box Bali ASP .Net 1 11-01-2008 08:34 PM
Page load of the parent page called twice when a modal dialog is opened from a button click of the user control on the parent page Samy ASP .Net 2 08-15-2005 03:30 PM
Aspx page opened as a modal dialog Lisa ASP .Net 1 01-18-2005 07:06 PM
How to close a parent modal window when child modal window opens? gopal srinivasan Javascript 0 11-05-2004 05:59 AM



Advertisments