Click here to Skip to main content
14,925,639 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
Hi i have a grid with 500+ records and the data values in the grid are updated every 5min...I need to "AUTO refresh " the grid for every 5 mins

Code am using:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:Timer ID="Timer1" runat="server" Interval="3600" ontick="Timer1_Tick"></asp:Timer>

<asp:GridView ID="GridView2
" runat="server" AutoGenerateColumns="False" DataKeyNames="CustomerID"
DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True">

Code behind:
protected void Timer1_Tick(object sender, EventArgs e)

But it is not working please help me ...

you can either use a icallback or you can use a web service call to refresh the grid . use javascript timer to call this( either web service or icallback) at every 5 minutes...
Use SignalR --- the server notifies the client that it has to refresh the data
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

      <asp:Timer ID="Timer1" runat="server" Interval="20000" OnTick="Timer1_Tick"></asp:Timer>
 <asp:UpdatePanel runat="server">
         <asp:GridView ID="DGVsa" runat="server"></asp:GridView>
              <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />



in .Cs

protected void Timer1_Tick(object sender, EventArgs e)

public void Gridbinding()
        sqlSA = "SELECT * FROM Mas_Display"
        DGVsa.DataSource = con.ReturnQuery(sqlSA);
You can refresh Grid by calling

CHill60 30-Nov-15 4:31am
You have added nothing to the other solutions posted over 3 years ago. In fact your "solution" doesn't even suggest where to put this code.
Answering old questions like this will only attract downvotes and reports.
you can refer this link how to autorefresh gridview[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900