(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
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.
Hello BIlly,
Thank you for posting in our forums.
The clarification was very helpful because I was not able to reproduce the issue with the online sample
http://samples.infragistics.com/aspnet/Samples/WebDataTree/Performance/LoadOnDemand/Default.aspx?cn=data-tree&sid=e3bab63c-d017-4547-8a27-785d948b90a6
You are correct LoadOnDemand of the tree refers to the population of the nodes , but not to the hierarchical datasource.
If you want to bind only the first level of the WebDataTree and load from the database the others on demand, you should use manual load on demand.
http://samples.infragistics.com/aspnet/Samples/WebDataTree/Performance/ManualLoadOnDemand/Default.aspx?cn=data-tree&sid=c257cd9c-1c5a-4159-aa51-ff8ea8386395
Let me know if you need further assistance.