Solved

How do I redirect all Frames within a Frameset in ASP.NET?

Posted on 2004-09-22
7
3,919 Views
Last Modified: 2008-01-16
I am using ASP.NET (latest version) for the development. I have framesets that consist of several frames such as "Header", "Footer", Left and Right frames.  When the user chooses a certain request I want to redirect the user to an entirely different frameset (different URLs). The "Response.Redirect" only works for whichever frame it is executed in.  How do I get the other frames to redirect?

For example, if I am in the Footer how can I get the Header to redirect itself?
 
0
Comment
Question by:Finch
  • 4
  • 2
7 Comments
 
LVL 24

Assisted Solution

by:Justin_W
Justin_W earned 500 total points
ID: 12129141
Embed a script like the following in any of the frame's content:

<script language="VBScript">
window.top.location="./newPage.aspx"
</script>
0
 
LVL 24

Expert Comment

by:Justin_W
ID: 12129148
You can embed such a script dynamically using the Page.RegisterClientScriptBlock() or Page.RegisterStartUpScript() methods, or by using Response.Write().
0
 

Author Comment

by:Finch
ID: 12129312
Could you give an example of how I can do this in C# in a code-behind section?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 24

Accepted Solution

by:
Justin_W earned 500 total points
ID: 12129322
Given a string variable "script" containing the script block:
   this.Page.RegisterStartupScript("someUniqueScriptKey", script);
or
   this.Page.RegisterClientScriptBlock(("someUniqueScriptKey", script);
0
 

Author Comment

by:Finch
ID: 12129415
I think the following is close, how do I indicate the script language and how do I put the Path in quotes?

String strTemp = "<script>window.top.location=http://localhost/WebApplicationGGH1/GGH_Blocks/TM1/GGH_Welcome_TM1.aspx</Script>";            

Page.RegisterClientScriptBlock("Redirect", strTemp);
0
 
LVL 24

Expert Comment

by:Justin_W
ID: 12129517
Oops, I made a typo.  Use:
   <script language="javascript">
not:
   <script language="VBScript">

Sorry about that.
0
 

Expert Comment

by:Masaia
ID: 13468153
Hey Finch,

I'm Marc... 31 years old, about 10 years experience in development of internet applications.

To be honest, I love to combine JavaScript and VB... So in this case, if a certain page is asked for, handle it in the javascript. It's allowed to create JavaScript in VB and put it in the <script language='JavaScript'> part of a HTML-document. So... If you want a frame (or several) redirected, have the page you're about to publisch 'force' a redirection of the other frames. You know, with the document.frames("...").location.href = '...' syntax... You can catch the 'value/id' to be used before it, and have it place in the JavaScript of the page (an Init or something, if you want to control it).

I hope this can be of assistance...

Man, I'm a bit wasted... I was looking for something, but... I can't remember exactly what... I have that quiet often. *grin* Always asking questions which give no answer... Ah well, I'll keep on looking.

Ciao everybody!

Masaia
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question