In this article I will explain with an example, how to refresh (reload) GridView periodically at regular intervals using AJAX Timer control and UpdatePanel in ASP.Net using C# and VB.Net.
	 
	Database
	Here I am making use of Microsoft’s Northwind Database. The download and install instructions are provided in the following article.
	 
	Concept
	The GridView will be placed inside an ASP.Net AJAX UpdatePanel along with the ASP.Net AJAX Timer control.
	The ASP.Net AJAX Timer control will periodically trigger its OnTick event which will refresh (reload) the GridView control.
	 
	HTML Markup
	The HTML Markup consists of an ASP.Net GridView which is populated with the help of SqlDataSource control, a Label, an AJAX UpdatePanel and an AJAX Timer control.
 
	
		<asp:ScriptManager ID="ScriptManager1" runat="server">
	
		</asp:ScriptManager>
	
		<asp:UpdatePanel ID="UpdatePanel1" runat="server">
	
		    <ContentTemplate>
	
		        <asp:Label ID="lblTime" runat="server" />
	
		        <br />
	
		        <br />
	
		        <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false">
	
		            <Columns>
	
		                <asp:BoundField DataField="CustomerId" HeaderText="Customer Id" />
	
		                <asp:BoundField DataField="ContactName" HeaderText="Contact Name" />
	
		                <asp:BoundField DataField="Country" HeaderText="Country" />
	
		            </Columns>
	
		        </asp:GridView>
	
		        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>"
	
		            SelectCommand="SELECT TOP 10 * FROM Customers ORDER BY NEWID()"></asp:SqlDataSource>
	
		        <asp:Timer ID="Timer1" runat="server" OnTick="TimerTick" Interval="1000" />
	
		    </ContentTemplate>
	
		</asp:UpdatePanel>
 
	 
 
	Refresh (Reload) GridView periodically at regular intervals in ASP.Net
	The Label control is set with the current Date and Time in two places, first inside the Page Load event and second inside the OnTick event handler of the ASP.Net AJAX Timer control.
	Inside the OnTick event handler, the GridView is again populated with the updated data from database by calling the DataBind function.
	C#
	
		protected void Page_Load(object sender, EventArgs e)
	
		{
	
		    lblTime.Text = "Last Refreshed: " + DateTime.Now.ToString();
	
		}
	
		 
	
		protected void TimerTick(object sender, EventArgs e)
	
		{
	
		    lblTime.Text = "Last Refreshed: " + DateTime.Now.ToString();
	
		    GridView1.DataBind();
	
		}
 
 
	VB.Net
	
		Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
	
		    lblTime.Text = "Last Refreshed: " & DateTime.Now.ToString()
	
		End Sub
	
		 
	
		Protected Sub TimerTick(ByVal sender As Object, ByVal e As EventArgs)
	
		    lblTime.Text = "Last Refreshed: " & DateTime.Now.ToString()
	
		    GridView1.DataBind()
	
		End Sub
 
	 
 
	Screenshot
![Refresh (Reload) GridView periodically at regular intervals using AJAX Timer in ASP.Net using C# and VB.Net]() 
	 
 
	Downloads