RegisterStartupScript Fails in Modal Dialog

G

Guadala Harry

I have a frameset aspx page that enables users to upload photos. One
frame/page shows a thumbnail list of prevously-uploaded images, and the
other frame/page includes the controls that enable selecting and uploading
additional photos. After uploading a file, the list of thumbnail images
needs to get refreshed to show the newly uploaded picture. This is
accomplished by using the following code:

string scriptString = "<script
language=JavaScript>parent.thumbFrame.location.reload(true)</script>";
if(!this.IsClientScriptBlockRegistered("clientScript")){
this.RegisterStartupScript("clientScript", scriptString);

This setup works great - but only as long as the frameset is opened by
itself (i.e., not as a modal dialog). When the frameset is opened as a modal
dialog (from client-side JavaScript using window.showModalDialog()), the
page in thumbFrame does not reload. It is as if the JavaScript registered
through RegisterStartupScript is not executed on the client.

How can I get the thumbFrame to reload when the frameset has been opened as
a modal dialog?

Thanks!
 
J

John Hann

Guadala said:
I have a frameset aspx page that enables users to upload photos. One
frame/page shows a thumbnail list of prevously-uploaded images, and the
other frame/page includes the controls that enable selecting and uploading
additional photos. After uploading a file, the list of thumbnail images
needs to get refreshed to show the newly uploaded picture. This is
accomplished by using the following code:

string scriptString = "<script
language=JavaScript>parent.thumbFrame.location.reload(true)</script>";
if(!this.IsClientScriptBlockRegistered("clientScript")){
this.RegisterStartupScript("clientScript", scriptString);

This setup works great - but only as long as the frameset is opened by
itself (i.e., not as a modal dialog). When the frameset is opened as a modal
dialog (from client-side JavaScript using window.showModalDialog()), the
page in thumbFrame does not reload. It is as if the JavaScript registered
through RegisterStartupScript is not executed on the client.

How can I get the thumbFrame to reload when the frameset has been opened as
a modal dialog?

Thanks!

I don't know the technical reason this occurs, but I've overcome it by
having the modal dialog consist of only an IFRAME, which then contains
the real aspx page.
 
G

Guadala Harry

I will be happy to use an IFrame if that is necessary. AS a followup
question: I thought I read somewhere that IFrames were being "phased out".
Is there anything to that - or was that just someone's biased *opinion*
against IFrames?

-G
 

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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top