Wednesday, July 30, 2008

Data Refresh Problem in XMLDatasource

In one of my application I was using XmlDataSource to populate the TreeView control but the data were not changing across the multiple logins. Like although the menu items were different for different Users but the User who logs in later was getting the same menu items as the previous user, The datatable I have given to the XmlDataSource was refreshing (as expected) but still the XmlDataSource was showing old data (Previous User's data).



I tried lot of things but later on I came to know that a single line of code could solve this issue by disable the caching in the XmlDataSource.

xmlDataSource.EnableCaching = false;



Put the above line before the data is actually bound to the control.