Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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

Posted on 2004-09-22
Medium Priority
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?
Question by:Finch
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 24

Assisted Solution

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

<script language="VBScript">
LVL 24

Expert Comment

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

Author Comment

ID: 12129312
Could you give an example of how I can do this in C# in a code-behind section?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 24

Accepted Solution

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

Author Comment

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);
LVL 24

Expert Comment

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

Sorry about that.

Expert Comment

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!


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

609 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