Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Dear Friends,
 
Am working on Asp.net C#, GRIDVIEW , SqlServer 2005.
 
I have Created a program in Asp.net c# and Database as SqlServer 2005.
 
My SqlServer Database will Update the data for every 1 Minute. So am displaying this data in Gridview.
 
So my problem is What should i use to update my GRID for every 1 minute.
 
Script Manager
Updatepanel, Content Template
Timer..
 
Can i use Timer for this ? or else I can Use Updatepanel.
 
Please help me.
 
THANKS
Posted 28-Nov-12 0:11am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Please refer following code. I hope that helps.Smile | :)
Also you have to add Script Manager.
 
<asp:updatepanel id="UpdatePanel1" runat="server" xmlns:asp="#unknown">
 

 
<asp:timer id="Timer1" runat="server" interval="3600" ontick="Timer1_Tick">
 
<asp:gridview id="gvContact" runat="server" autogeneratecolumns="False" datakeynames="ContactID">
 
DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True">
 

 
<asp:boundfield datafield="ContactID" headertext="ContactID" readonly="True" sortexpression="ContactID" />
 
<asp:boundfield datafield="CompanyName" headertext="CompanyName" sortexpression="CompanyName" />
 
<asp:boundfield datafield="ContactName" headertext="ContactName" sortexpression="ContactName" />
 
<asp:boundfield datafield="Address" headertext="Address" sortexpression="Address" />
 
<asp:boundfield datafield="City" headertext="City" sortexpression="City" />
 

 

 

 

 

protected void Timer1_Tick(object sender, EventArgs e)
 
{
 
gvContact.DataBind();
 
}
  Permalink  
v2

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



Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid