i use Version 11.1 with CLR 4.0 in VS2010 Prof. The WebExploreBar (WEB) is bound to a WebHierarchicalDataSource (WHS). The data for WHS comes from a SqlDataSource (SDS) with a stored proc (SP) in backround. The Hierarchie is build via a foreign key column (FK_Parent) inside the SP. So i construct a self referencing structure, like a tree, and i want only the leafs to navigate to an Url.
Normaly i bound the SDS to the WHS and set the relation. Then i bound the WHS-ID as DataSourceID of the WEB and the ExplorerBarItemBinding to the View of the WHS.
This works fine, if there are only flat hierarchies of 2 levels. But if there are more nested levels, what is the best way to handle this?
Should i duplicate the possible Levels in the WHS and add an extra Item binding in the WEB?
Or should i catch the click on client-side and look for the level and possible childs?
Thank's for reply
Thank you for posting in our forums.
If you have more than one level you should add another ExplorerBarItemBinding object to the collection:
You can use also LoadOnDemand if you want to increase the performance:
Let me know if you have further questions.
since i use a self reference in the table and at compile time number of levels is not fixed; adding additional ExplorerBarItemBinding to the collection is not the solution (or should i generate the different Bindings in code, depending of the levels?).
I helped me with a trick, i set the 'NavigateUrlField' of ParentItems to Null, so if i select a parent, it expand, showing the child nodes.
This works like a tree, what i was looking for. But is there a way to set the layout of the items collection like a tree control (with a + sign if the item has children and is colapsed an a - sign if it is expanded and no sign if it is a leaf)?
Hello Patric ,
Thank you for the update.
If you want to have the layout of the WebDatTree control and using manual load on demand ( not knowing the levels ) I recommend you choosing the WebDataTree controls
If you want to show +/- images of the ExplorerBarItems you should set the ImageUrl property
But you should also change the HoverCssClass of the ExplorerBarGroup if you want different behavior there.
Please let me know if you need further assistance regarding this
sorry for the time delay, had much to do.
To use the WebDataTree is not the solution, since i want to use the expanding and colabsing panels of the ExplorerBar, but inside each Panel i need the layout of a tree. By writing these lines, i got an idea. I use one Datasource to select all root levels of my hierarchical structure to generate the 'Group Items' of the ExplorerBar, then i add a WebDataTree to each Group and bind it to a second Datasource.
Do you think this is possible and on what event must i add the WebDataTree to the Groups Item Collection??
The idea should be possible using templates in order to have custom content in ExplorerBarItem
You can add WebDataTree inside the template and handle ItemClick event on the server. If the item is ExplorerBarGroup, you can access its item and after finding the template you can get the WebDataTree and set appropriate DataSource
Please let me know if you have further questions