Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
600
WebDataTree loads ENTIRE data hierarchy even though InitialDataBindDepth="0"
posted

(I already made a post today asking how to use parameterized queries for the datasources used by WebHierarchicalDataSource. But now we have a more disturbing issue).

We want to load a fair amount of data in our WebDataTree, and the database tables are very large, so we wanted to use the "Load On Demand" feature of the WebDataTree. We also want to use the convenient and (in theory at least) very cool WebHierarchicalDataSource.

So ... I noticed that the datasources bound to levels 1 and 2 our tree hierarchy were being populated in first-time logic (IsPostBack = false), even though InitialDataBindDepth="0" was set for the WebDataTree. I thought it was something we were doing, but I created a test web project using the AdventureWorks database that was almost identical to the "Load On Demand" sample, except it used the AdventureWorks on SQL Server. I turned on the SQL Server profiler and confirmed that the database was being hit right away. When you click on a level 0 node, the database is hit AGAIN.

So what's the story? Does anyone know? Am I doing something wrong? To me this seems like an out-an-out bug, and makes a joke of the term "Load On Demand".

BillyB

Parents
No Data
Reply
  • 600
    posted

    I should probably be a bit clearer: the rendered HTML that is sent to the client does NOT include all the bound child nodes in the hierarchy. In the UI sense, it is in fact "load on demand." However, the WebHierarchical datasource IS binding the entire hierarchy behind the scenes in first-time logic even with the InitialDataBindDept set to 0, and consequently causing a huge hit to the database.

    Just because the web servers aren't stressed doesn't mean the database won't be brought to it's knees, which will have the same effect.

Children