response.redirect with frames

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Frames. Yack, I agree. BUT, I've been mandated to use them.

Let's assume a page has a simple top and bottom frame. I have been told
that there is NOT a way to use Response.Redirect("http://someotherurl.com/")
in the bottom frame page to
redirect the entire browser window, not just the bottom frame. However,
I've been given a suggestion to use javascript and RegisterStartupScript.

Conceptually, how would this work?? Here are my rambling thoughts:

1. In the "bottom page", a postback occurs and it's determined that the
entire browser window should be redirected.
2. The "main" page that contains both the top and bottom frame contains some
function that redirects the entire window to some specified page.
3. The javascript in the bottom page somehow calls the function in the
"main" page listed in #2 above.

Any suggestions, pseudo code or details would be appreciated. Thanks!

Mark
 
string s = "<script type=\"text/javascript\">parent.frameName.location =
\"someUrl\";</script>"
if (!IsStartupScriptRegistered("MyScript"))
RegisterStartupScript("MyScript", s);

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Kevin,

This works beautifully. However, RegisterStartupScript is a method in the
Page class. Is it possible to leverage this type of functionality in the
Global.asax.cs file? I'd love to leverage this in my global error handler
found in the global.asax.cs file. As you know, this file does not inherit
from Page, but I imagine this makes it inherently impossible to do a fancy
redirect from this page. Comments?

Thanks again Kevin. The code will work beautifully everwhere else I need it.

Mark
 
The global error handler must redirect to some page. That page would have to
include the scripting in it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top