Click here to Skip to main content
11,438,007 members (46,839 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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">
<ContentTemplate>
<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)
{
GridView2.DataBind();
}

But it is not working please help me ...
Posted 11-Jun-12 11:46am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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...
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 10

Use SignalR --- the server notifies the client that it has to refresh the data
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 11

<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">
          <ContentTemplate>
         <asp:GridView ID="DGVsa" runat="server"></asp:GridView>
          </ContentTemplate>
          <Triggers>
              <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
 
          </Triggers>
 
      </asp:UpdatePanel>
 

in .Cs
 
protected void Timer1_Tick(object sender, EventArgs e)
       {
Gridbinding()
 
       }
public void Gridbinding()
{
        sqlSA = "SELECT * FROM Mas_Display"
        DGVsa.DataSource = con.ReturnQuery(sqlSA);
        DGVsa.DataBind();
}
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

you can refer this link how to autorefresh gridview[^]
  Permalink  
v3

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



Advertise | Privacy | Mobile
Web03 | 2.8.150506.1 | Last Updated 18 Jul 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100