Frame for Response.Driect or Server.Transfer

G

Guest

This is driving me mad so any help will be much appreciated.

I have an html page with 3 frames, banner, left and right. The banner frames
source is an aspx page. The aspx page has two buttons, both need to run some
code and then redirect the user somewhere else. The problem is the redirected
page is being displayed in the banner frame. How do I tell either
Response.Redirect or Server.Transfer what frame to display the page in or
that the redirected page isn’t to be displayed in any of the frames?

Thanks for any help.
Chris.
 
G

Guest

Chris,

The source of your problem here is that IFRAMES aren't really a feature of
Server Side ASP.Net Code. Basically, if the result of your server side code
(which i assume is in an iframe) needs to directly affect the iframes of the
parent page, then you need to pass an indication back to the client side,
indicating that you wish to alter the pages displayed in your iframes.

The way i do it is as follows; I run the server side code, and then place a
value in an ASP.Net text box which has a style tag "DISPLAY:None" (so that
the end user doesn't see it).

In javascript, Create a client-side window.onload event. In the
window.onload event, I check to see if the textbox contains a value using
code similar to the following:

if(Form1.txtTextBox.value.length > 0){
//redirect banner left to other page
window.parent.frames(1).location.href = "otherpage.aspx";
//redirect banner right to other page
window.parent.frames(2).location.href = "anotherpage.aspx";
}

Basically, you need to give your aspx page some server-side indication of
what it is meant to be doing; eg, Telling it that it needs to redirect other
frames to other pages.

Hope this is of help to you.

m00nm0nkey !!!
 
G

Guest

Thanks for the reply.
I had a feeling I was going to have to use some java script which I was
hopeing to aviod as I don't know it. I'll give your sample a try.

It feels like MS missed something out to me. I don't know may be its just me.
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top