this.treeMain.Levels[0].LevelKeyField = "name";
this.treeMain.Levels[0].ColumnName = "name";
So, how exactly do you sort each level of the tree then?
Thanks.
also, for your code example, it still only shows one field being bound to each level, not two. I need each level to say "name (acronym)" where name is a field, and acronym is another field in the same dataset. That doesn't seem to be possible when binding?
Thanks Rumen. I'll try your suggestion out. But, I think that the only real way is to add all data to the tree, and use the 'LoadOnDemand' feature, to only load data when the user expands a node? That would be the best compromise between both methods, correct? As, for example if I were to only load the first level of the tree, but to also have the expand '+' sign beside each node, I would have to load dummy data for the first level, then when the user expands a node, load the real data for level 2, then the same thing for level 3. For each node in level 1, I can safely assume, that there is guaranteed to be data in level 2, and for each node in level 2, I can also safely assume that there is guaranteed to be data in level 3, so this might work, but I'm not 100% sure, if it would speed things up considerably, vs just using the ''LoadOnDemand' feature? Any ideas?
Hello,
Yes, I think I understand the scenario you are looking for. However this is something that unfortunately is not supported in the TreeView. Downloading 300,000 rows at once will always be slow and especially in a web browser / HTML context.
Since you are asking for multiple fields (columns) in your previous post, I am wondering if a "grid" product is more suitable for what you need. Our UltraWebGrid product support "Virtual Scrolling" mode, where new rows are added as the user scrolls down with the scrollbar and might be better suited for your needs.
If you need to add (map) more than one field to tree node, you will either need to use the DataBindings functionality, or better yet - hook the NodeBound event of the TreeView and map datasource fields to node properties there. Example:
<ignav:UltraWebTree ID="UltraWebTree1" runat="server" CheckBoxes="true" onnodebound="UltraWebTree1_NodeBound"> </ignav:UltraWebTree> protected void Page_Load(object sender, EventArgs e) { DataSet dataSet = new DataSet(); DataTable orders = new DataTable(); orders.TableName = "Orders"; orders.Columns.Add("ID"); orders.Columns.Add("Name"); orders.Columns.Add("IsChecked"); orders.Rows.Add(new object[ { 1, "Nike shoes", true }); orders.Rows.Add(new object[ { 2, "Adidas shoes", false }); orders.Rows.Add(new object[ { 3, "Puma shoes", false }); DataTable details = new DataTable(); details.Columns.Add("ID"); details.Columns.Add("ParentID"); details.Columns.Add("Name"); details.Columns.Add("IsChecked"); details.Rows.Add(new object[ { 1, 1, "Air Jordan", true }); details.Rows.Add(new object[ { 2, 2, "Kevin Garnett", false }); details.Rows.Add(new object[ { 3, 3, "Brazil Football", false }); dataSet.Tables.Add(orders); dataSet.Tables.Add(details); dataSet.Relations.Add("OrderDetails", orders.Columns["ID"], details.Columns["ParentID"]); UltraWebTree1.Levels[0].RelationName = "OrderDetails"; UltraWebTree1.Levels[0].ColumnName = "Name"; UltraWebTree1.Levels[1].ColumnName = "Name"; UltraWebTree1.DataSource = dataSet.Tables[0].DefaultView; UltraWebTree1.DataBind(); } protected void UltraWebTree1_NodeBound(object sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e) { DataRow dataRow = e.Node.DataItem as DataRow; if (Convert.ToBoolean(dataRow["IsChecked"])) { e.Node.Checked = true; } }