.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Ajax >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Updating GridView Using AJAX

Posted By:Hefin Dsouza       Posted Date: August 11, 2009    Points: 10    Category: Ajax    URL: http://www.dotnetspark.com  
 

The Following Code Snippet Will Allow you to Dynamicaly Populate Data in a GridView Apart From this The Data Will also keep on Updating Automatically Without Refreshing the Page
1. Drag And Drop An UpdatePanel
2. In The UpdatePanel Drag And Drop The Following Controls
a. ScriptManager
b. Timer
c. GridView
3. On the Timer's Tick Event Write The Following Code

Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim ds As New DataSet
ds.ReadXml(Server.MapPath("DataFile.xml"))
GridView1.DataSource = ds.Tables(0)
DataBind()
End Sub


4. Compile the Page

P.S:- For Demonstration Purpose I have used XML data You can use Data From DataBase also.

Regards
Hefin Dsouza

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend