Hello I am new to using Infragistics controls, I have several questions bout the WebDataTree that I would like some help on. But first here is the scenario.
I am trying to use the WebDataTree to allow uses to create and edit a virtual filing structure. This structure contains a root folder, that can only contain child nodes. There are 3 different types of filing containers that a root node can contain. Of these two container types two can contain child nodes of there own type, the other can not contain any children at all. When one of these nodes are selected I would like to display a collection of controls (depending on type of container) allowing users to edit metadata of the filing structure,
My questions;
1. What is the best approach for binding a WebDataTree to a dynamic tree as explained above?
2. How do you designate a "Top" Node that can only have child and nothing above it?
3. Does your edit mode allow for custom views, where I can build my own custom collection of controls to edit?
Hello SIG,
Do not hesitate to contact me if you have any additional questions regarding this matter.
WebDataTree could be bound to an IEnumerable collection. For example let`s say the tree is bound to an IEnumerable that contains Person objects:
class Person { private int _id; private string_name; private List<Person>_children; private ArrayList_addresses; } <ig:DataTreeNodeBinding DataMember="Person" TextField="Name" ValueField="Id" KeyField="Id"/>
class Person
{
private int _id;
private string_name;
private List<Person>_children;
private ArrayList_addresses;
}
<ig:DataTreeNodeBinding DataMember="Person" TextField="Name" ValueField="Id" KeyField="Id"/>
The List of _children would be automatically get picked up by the data tree and get made into child nodes.
A sample project demonstrating DataBinding could be found at:
http://ko.infragistics.com/products/aspnet/sample/data-tree/data-binding
Hopefully, this can get you started.
Regarding your second question what I can suggest is handle NodeDropping event of WebDataTree . Depending whether the destination node has a parent(if not that means that it is the root node) the dropping event could be canceled. For instance:
function WebDataTree1_NodeDropping(sender, eventArgs) { if (eventArgs.get_destNode().get_parentNode() == null) { eventArgs.set_cancel(true) } }
function WebDataTree1_NodeDropping(sender, eventArgs)
if (eventArgs.get_destNode().get_parentNode() == null) {
eventArgs.set_cancel(true)
I hope this helps. Feel free to contact me if you need any further assistance with this matter.
Hello I am still not quite clear how to set a Root using an enumerable collection. I need to all the children of the root to be drag and drop anywhere but above the root node. Do you have any examples of this?
I am still following your case. Have you been able to resolve your issue? Do not hesitate to contact me if you have any additional questions regarding this matter.
Thank you for posting in the community!
1) WebDataTree supports a large number of bindable datasources. If you want to generate a tree node structure an Xml Data Source could be used. In order to retrieve your data from the Xml file, the data bindings for the nodes should be specified via the data binding editor. The data will be represented in hierarchical, node-like structure.
Alternatively WebDataTree can be used to represent hierarchical data in a tree like structure. Hiererchical data can be offered by many sources such as datasets, custom objects, ObjectDataSource etc. The WebHierarchicalDataSource component can be used to create and represent your hierarchical data model.
Some further reference could be found at:
http://help.infragistics.com/NetAdvantage/ASPNET/2012.2/CLR4.0/?page=WebDataTree_Binding_to_Data.html
Some saples illustrating Data Binding for WebDataTree could be found at:
2) Whether a node in the tree would have children or not could be cofigured via the tree`s DataSource. If a particular node is set as a root node in the datasource and afterwards bound to the WebDataTree control this will ensure that there won`t be any noodes in the hierarchy above this one.
3) I assume that templating is what you are looking for. Teplating allows to customize node rendering by inserting an ASP.NET and HTML content into the code. The following templating methods are supported:
With templating each individual node object`s look and feel could be cutomized depending on your requirements. However, please note that when a tree node is templated it could not be put into edit mode.
Some further reference to node templating and samples could be found at:
http://help.infragistics.com/NetAdvantage/ASPNET/2012.2/CLR4.0/?page=WebDataTree_Node_Templating.html
http://ko.infragistics.com/products/aspnet/sample/data-tree/templates
Hope this helps. Let me know if you have any further questions.