Sunday, March 11, 2012

Ajax + Timer + GridView

I guess no one knows then? :-)
You'd better place asp:GridView in a asp:UpdatePanel.Thus there is only partial post back taken place when refreshing the datasource of the asp:GridView.Try to use aFileSystemWatcher to monitor if the text ?file changes.If there is any change taken place,you?should refresh the datasource of the asp:GridView.So it is not necessary to use timer control to read the text file every sencond.
Try to take a look this link from MSDN about?FileSystemWatcherfor details - http://msdn2.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx

Wish?this?can?help?you.
For starters thanks a lot for your help. Just a few things. I have had brief look at the FileSystemWatcher Class. It has a
OnChanged(object source, FileSystemEventArgs e) function that i presume looks at the textfile for a change? The thing is i need to pull out an entire line at a time from that
text file and write each line to a GridView as it happens, so i really need to check when a new line is added rather than a change to the text file, is that possible with FileSystem
Watcher?
Lastly i just want to know once i detect a new line and already have a line written to the GridView can i just add that SINGLE line to the GridView or do i actually have to
write all the data from the text file to the GridView again? The reason i ask this is because if i need to totally re-poulate the GridView with each line detected from the text
file i'd need to store each line in an array rather than just hold each line in a string and just write it?
Any more advice would be great. 

No comments:

Post a Comment