Click here to Skip to main content
12,249,279 members (34,346 online)
Rate this:
 
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 1: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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 28 Nov 2012
Copyright © CodeProject, 1999-2016
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