FAQ Friday recap

FAQ Friday recap

  • Comments 2

I want to thank everyone who came out for our first FAQ Friday devBrainPick event last week. I especially appreciate everyone's patience with our format hiccups...this being a new series and format, I suppose that's to be expected. :-)

We did have one question that came up during the session that we weren't able to answer right away. One of the attendees was having an issue with binding data to a TreeView control in ASP.NET, and was not seeing the expected results. There's a post about the issue on the ASP.NET forums here. I replied to that thread, but also want to share the solution here. The issue that the attendee was running into was that they were adding random data to their datasource, and expecting to see different results each time the page was refreshed. Instead, the same data was displayed with each request.

It turns out that what they were running into was the fact that the XmlDataSource control caches data by default. So unless you disable caching like so:

myXmlDS.EnableCaching = False

you will get cached results even if you re-bind the XmlDataSource, until the cache expires.

Hat tip to Andrew Stopford, who ran into this too, and to his commenter who posted the solution.

 

  • Every time the page is "refreshed", a NEW XmlDataSource is created. Do we need disable caching for that new XmlDataSource? It does not make sense....
  • Per the follow up from Eilon on the forum thread, this appears to be a bug in the XmlDataSource control. Changing the Data property should invalidate the cache, but doesn't.

Page 1 of 1 (2 items)