The WebDataTree is cool in that it automatically renders any properties that are collections in the object hierarchy. What if I only want it to only render a particular property collection and ignore the others?
I thought that was done by setting the DataMember property to the name of the property that it should recursively render but that doesn't seem to work. It still renders the other properties that are collections.
Am I missing something in the documentation?
Thanks!
Kevin
Hello Kevin,
could you clarify what you are trying to achieve.
Thank you
Hristo,
Sure, I apologize for the delay I was out last week.
I am data-binding a WebDataTree control to an object. This object has several properties. One of the properties is a collection of the original object that I databind the control to. This property is recursive. Each Module object may contain a collection of Module objects. (If it doesn't have a Module collection then the WebDataTree control needs to stop rendering nodes, and it does)
For example:Object Name -> Property NameModule -> DisplayName (The name of the module)Module -> UserModules (A collection of Module objects)Module -> ModuleProperties (A collection of ModuleProperty objects)
The WebDataTree control works great rendering the Module collections as new nodes as it should. The problem I have is that it also renders the ModuleProperty collections as nodes. I do not want this property to be rendered as a node.
I thought the solution was to set the DataMember property of the WebDataTree to the name of the property that I want to recursively render as nodes but it doesn't seem to make a difference.
Here's the code I am using if it is helpful:UserModuleCollection userModuleCollection = value;this.trvModulesDataTree.DataSource = userModuleCollection;this.trvModulesDataTree.DataMember = "UserModules";this.trvModulesDataTree.DataBind();
In the NodeBound event of the WebDataTree control I have this code:UserModule currentNode = (UserModule)e.Node.DataItem;if (currentNode.HasModuleAccess == true){ e.Node.CheckState = Infragistics.Web.UI.CheckBoxState.Checked;}else{ e.Node.CheckState = Infragistics.Web.UI.CheckBoxState.Unchecked;}e.Node.Text = currentNode.DisplayName;e.Node.ToolTip = currentNode.ModuleDescription;
Let me know if there is something I have failed to let you know here. Basically I do not want the control to render the ModuleProperty property as a node. I want it to exclusively render the UserModules as nodes.
Hello Kevin,thank you for the detailed description. By design WebDataTree renders all properties. I would like to encourage you to submit a feature request if you want to see such feature that allows you to choose which collection to be rendered.
As an option you can use custom view object which contains only those properties that you want to render or just to try to remove unwanted nodes in the NodeBound event.
Hope this helps