This is for improving knowledge of dot net technology, I have posted some articles related to Ajax, C sharp, vb.net, threading, linq, webservices, jQuery, Caching, .net Architecture, .Net Remoting, ADO.net, Authentication, ASP.net Overview, Debugger, Email integration, FTP, Payment Gateway, Performance and Scalability, Security, VS.net 2008, Web controls, Web Parts, WCF, WPF and SQL serve
Tuesday, June 16, 2009
Auto Refresh data on page using AJAX
Hi this is my first article on C# corner. I have some good topics in my mind, stay tuned.
In this article, I am going to explain how we can auto refresh data on an ASP.NET page after a certain interval using AJAX UpdatePanel and other controls. I am using some Ajax controls and using SQL server database and Data Grid control. Database name is north wind. In this application my interval time for refresh data is 30 second. You can change your time by times interval property.
Here is a snapshot:
This code for bind data:
con = New SqlConnection("Initial Catalog=Northwind; Data Source=localhost; Uid=sa; pwd=;")
cmd.CommandText = "select * from Employees "
cmd.Connection = con
da = New SqlDataAdapter(cmd)
GridData.DataSource = ds
You can check your current time on page load. Write this code: