Asp. NET page Refresh Implementation method

Source: Internet
Author: User
< meta http-equiv= "Refresh" content= "300; Url=target.html "> Refresh another Frame page with WINDOW.LOCATION.HREF implementation

In the writing of the ASP, we often encounter the problem of jump page, we often use Response.Redirect, if the customer to use the prompt when jumping, this is not an idea, such as:

Response.Write ("< Script>alert (' Congratulations, registration successful! '); </script> "); Response.Redirect ("main.html"); At this time our cue content did not come out on the jump, and Response.Redirect ("main.html"); There is no difference.

Then we experiment with the following code to try out the ASP. NET page refresh:

Response.Write ("< script Language=javascript>alert (' Congratulations, registration successful! ') </script> "); Response.Write ("< script language=javascript>window.location.href= ' main.html ' </script>"); This is the implementation of our requirements, after the prompt, jump page.

The most important thing is that the WINDOW.LOCATION.HREF statement can implement a framework page that refreshes the page of another frame after executing the server-side code (Response.Redirect cannot be reached, at least I have not found):

For example: The index.htm page has two frames, frameleft and frameright, respectively, and refreshes the pages in Frameleft after the server-side code is executed in the Frameright page.

Before the most common is registered, automatically refresh the login box, let the login box to the landing page, as long as the successful registration of the code after the addition of a paragraph, that can be implemented to refresh the page of another frame. The code is as follows:

Response.Write ("< script Language=javascript>alert (' Congratulations, registration successful! ') </script> "); Response.Write ("< script language=javascript>window.parent.frameleft.location.href= ' main.html ' </script > "); Asp. NET page refresh: Automatic Refresh Page Implementation Method Summary:

1)

< meta http-equiv= "Refresh" content= "10; Url= jump page "> 10 means refresh 10 seconds interval

2)

< script language= ' JavaScript ' > Window.location.reload (TRUE); </script> If you want to refresh an iframe, change the window to a frame name or ID number.

3)

< script language= ' JavaScript ' > window.navigate ("URL of this page"); </script> 4>

Function abc () {window.location.href= "/blog/window.location.href"; SetTimeout ("ABC ()", 10000);} Refresh this page:

Response.Write ("< script language=javascript>window.location.href=window.location.href; </script> ") Refresh parent page:

Response.Write ("< script language=javascript>opener.location.href=opener.location.href; </script> ") go to the specified page:

Response.Write ("< script language=javascript>window.location.href= ' yourpage.aspx '; </script> ")
Refresh page Implementation Summary (HTML,ASP,JS)

' By Aloxy

Timed refresh:

1,

< Script>settimeout ("location.href= ' url '", $) </script> Description: URL is the URL address of the page to be refreshed

2000 is the wait time = 2 seconds,

2,

< meta name= "Refresh" content= "N; URL "> Description:

n is the number of seconds to wait before loading the specified URL.

The URL is a absolute URL to being loaded.

N, is the time to wait, in seconds

URL is the URL address of the page to refresh

3,

<%response.redirect url%> Description: Generally use a URL parameter or table only son value to determine if an action occurs and then use Response.Redirect refresh.

4, Refresh frames page

〈script language=javascript>top.leftfrm.location.reload (); Parent.frmTop.location.reload (); </script〉 refresh after pop-up form

Response.Write ("< Script>window.showmodaldialog ('. /oa/spcl.aspx ', window, ' dialogheight:300px; dialogwidth:427px; dialogtop:200px; Dialogleft:133px ') </script> "); Open Response.Write ("< script>document.location=document.location; </script> "); Add < base target= "_self" to the subform page code head/>

The refreshed content is added to the IF (! IsPostBack) in

Refresh the left side of the frame page

Refresh the left half of the frame page Response.Write ("< script language=javascript>"); Response.Write ("parent.left.location.href= ' paydetailmanage_left.aspx '"); Response.Write ("</script>");
Page Timing Refresh Feature implementation

There are three ways to do this:

1, set in HTML:

< title>xxxxx</title> to join the following line!

Timed refresh:

< META http-equiv= "Refresh" content= "ten" > 10 for refresh interval in seconds

2.jsp

<% Response.setheader ("Refresh", "1"); %> refreshes every second

3. Using javascript:

< script language= "JavaScript" > SetTimeout ("Self.location.reload ();", 1000); < script> once a second

Page Auto Jump:

1, set in HTML:

< title>xxxxx</title> to join the following line!

Timed Jump and Refresh:

< meta http-equiv= "Refresh" content= "20; url=http://own url ", where 20 means 20 seconds after the jump to http://own URL page.


Refresh the parent window after clicking the button to submit the form

A window opens b window

Then submit the data in B to the C window.

Finally, to refresh the A window

and close the b window

Several JavaScript functions

First Auto Close window

< script language= "JavaScript" > <!--function Clock () {i=i-1 document.title= "This window will automatically close after" +i+ "seconds!"; if (i>0) setTimeout ("clock ();", 1000); else Self.close (); } var i=2 clock (); -</script>//second function to refresh the parent page

< script language= "JavaScript" > Opener.location.reload (); </script>//Third open window

< script language= "JavaScript" > function show (mylink,mytitle,width,height) {Mailwin=window.open (MyLink, MyTitle, ' top=350,left=460,width= ' +width+ ', height= ' +height+ ', Scrollbars=no ')} </script> questions about ASP. NET page refresh, It will be useful to collect these kinds of methods
  • Related Article

    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.