how to refresh page automatically after few seconds interval in asp.net ??

Leave a Comment
Refresh Page in asp.net automatically using Timer control with interval attribute.
Here i am giving you complete code for it.

step 1:just paste this code snippest in your default.aspx page.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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>Untitled Page</title>
    <link href="Content.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
   
   <asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick">
    </asp:Timer>
  
    </form>
</body>
</html>
Step 2: Now you don't need to do any thing. just set Interval attribute to change duration time only

output:

1] run your project it will show you nothing
2] after 5 seconds it will look like this.


I hope you are clear with this timer control....

0 comments:

Post a Comment