How to (how to refresh/redirect the contents of one frame from another frame)

Source: Internet
Author: User
(1) http://yemao.net/info/info.php? Sessid = & infoid = 62
Window. Parent
Specifies the frame to the top.

(2) http://www.vbcity.com/forums/topic.asp? Tid = 83870
The purpose of this FAQ is to explain how to refresh/redirect the contents of one frame from another frame

Hey there everyone, this is something I have seen a lot of discussion about on other forums. there are so large suggestions, so far wrong answers-I figured I might as well point out a pretty simple and elegant solution to this isue. first thing is that you can use this regardless of your experience with Java Script, I used this with C # code behind, but the VB code is almost identical. what you might use this for is to have a page posted or refreshed into a frame on the parent frame from inside another frame. here we go then. I will show the code, then explain it. it is very simple so this will not take long.

I am going to explain a bit more in detail as to why this snippet is useful in some situations. first, this is not the only solution, nor most likely the best solution in every case, however, it is a solution for when you are dealing with a frame that needs to have another frame refreshed, or reposted. when you are working in a frame, and use response. redirect, or server. transfer, the page is only redirected/reposted/refreshed to the current frame, not to another frame. this solution is for when you want to have one frame make another frame do something. thank you Edward for pointing some of these out of the me. now on to the code-end update.

Code:

String strredirect;
Strredirect = "<script language = 'javascript '> ";
Strredirect + = "parent. Frames ('framename'). Location. href = 'asp-page. aspx ';";
Strredirect + = "</SCRIPT> ";
Response. Write (strredirect );
Response. Flush ();

Okay, pretty simple huh? It is a lot more elegant than some answers I have seen. to explain, you simply use response. write to send writable ss a Java Scriplet that tells what frame and href to post. I hope this helps some of you in controling where and how your pages post if you ever make a page with either frames or iframes.

Kent

The section of the code ....

Code:

Response. Write (strredirect );
Response. Flush ();

... Pushes the JavaScript to the page and redirects the target frame. It's designed to use for button, link button, or link clicks.

The workaround works fine with IE but parent. frames is not working with Firefox. Use [] instead ()

Code:

String strredirect;
Strredirect = "<script language = 'javascript '> ";
Strredirect + = "parent. Frames ['framename']. Location. href = 'asp-page. aspx ';";
Strredirect + = "</SCRIPT> ";
Response. Write (strredirect );
Response. Flush ();


Jean-Luc
Www.corobori.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.