Auto Refresh XsltListViewWebPart in SharePoint

This blog explains the procedure of making an XsltListViewWebPart refresh, automatically. This can be achieved simply by writing a few lines of code given as below:
  1. SPFile spFile = web.GetFile("Lists/Country/AllItems.aspx");  
  2. SPLimitedWebPartManager wpManager =   
  3.     spFile.GetLimitedWebPartManager(PersonalizationScope.Shared);  
  4.   
  5. XsltListViewWebPart lvwp = (XsltListViewWebPart)wpManager.WebParts[0];  
  6.   
  7. lvwp.AutoRefresh = true;  
  8. lvwp.AutoRefreshInterval = 15;  
  9.   
  10. wpManager.SaveChanges(lvwp);  
Ebook Download
View all
Learn
View all