Tuesday, 19 February 2013

Refresh Page/Browser Automatically after a Particular Time Period III


Refresh Page/Browser Automatically after a Particular Time Period III


Use the following Code to Refresh Your Page/Browser Every 10 Seconds after Page Load...

Design Part:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Browser Refresh</title>
    <meta http-equiv="refresh" content="10">
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <h3>Browser is Refreshing Every 10 Seconds.. Notice the Time..</h3>
    <br />
    <br />
        <asp:Label ID="Label1" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label></div>
    </form>
</body>
</html>

Code-Behind:

    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text=DateTime.Now.ToShortTimeString();
    }


You Can Also Redirect the Current Page to another URL after a Certain Time Period:


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Browser Refresh</title>
    <meta http-equiv="refresh" content="15;url=http://www.dotnetvishal.com">
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <h3>This Page will be redirected to www.dotnetvishal.com in 15 seconds</h3>
    </div>
    </form>
</body>
</html>

No comments:

Post a Comment

Thank You for Your Comments. We will get back to you soon.

back to top