I have one xml file in my project's folder. I am reading the xml file and showing the data in GridView. If i change some data in that xml file immediately i have to show in my GridView with out refreshing the webpage.
How?
Thanks in advance..
Loading

Kirtan PatelRank #292 · 8.6K reputationPosted Jul 31, 2009, 11:38 PM EDT
private FileSystemWatcher fsw; protected void Application_Start(Object sender, EventArgs e) { string monitorPath = this.Context.Server.MapPath("upload/"); Application.Add("watcher", new System.IO.FileSystemWatcher(monitorPath)); fsw = (FileSystemWatcher)Application["watcher"]; fsw.EnableRaisingEvents = true; fsw.IncludeSubdirectories = false; fsw.Changed += new System.IO.FileSystemEventHandler(fsw_Changed); fsw.Created += new System.IO.FileSystemEventHandler(fsw_Created); }Try File SystemWatcher's Changed Event In global.asax file .
source
http://aspadvice.com/blogs/ericm/archive/2005/08/05/2706.aspx
Kirtan PatelRank #292 · 8.6K reputationPosted Jul 31, 2009, 10:50 PM EDT
It will refresh only that Grid View not whole Page .
Happy Coding :)
ramesh p66 reputationPosted Jul 31, 2009, 11:11 PM EDT
ramesh p66 reputationPosted Aug 1, 2009, 12:19 AM EDT
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 1, 2009, 11:15 AM EDT
Write following code like below after adding new global.asax file to project protected void Application_Start(Object sender, EventArgs e) { FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = Server.MapPath(".") + @"\FTP"; watcher.NotifyFilter = NotifyFilters.CreationTime; watcher.Filter = "YourFile.txt"; watcher.Changed += new FileSystemEventHandler(OnChanged); watcher.EnableRaisingEvents = true; } private void OnChanged(object source, FileSystemEventArgs e) { //Do whatever you want! // Yuo Can Call your custome method that refresh data in Page }