Hi everyone,
I have a tree which display components and the tree's DataSource has been set to a DataTable. I need to select particular component(Node) programatically using some conditions and select that node. Also when it is selected, I want the node's parent and children nodes should be expanded, not all nodes in the tree. I have used the following coding but it takes alooooot of time to load and to show the node.
In InitializeComponent()
this.utComponentTree.DataSource = this.componentBindingSource;
When the Search button is clicked
/* dt has the values that should be compared with the treeNode value and utComponentTree is the UltraTree*/
{
if (((System.Data.DataRowView)(descendants[i].ListObject)).Row["component_id"].ToString() == dt.Rows[0]["component_id"].ToString() )
}
utComponentTree.ExpandAll(ExpandAllType.OnlyNodesWithChildren);
this.GetAllDescendants(node.Nodes, retVal);
descendants.Add(node);
Is there an easy for to do this with less loading time?
Please give me some code samples if possible. If anyone need clarifications pls let me know.
Thanks in Advance!
Accessing the child rows from the data source can be an expensive operation, so that might be the cause of the latency you are observing, since you are calling the control's ExpandAll method, which is causing the data source to retrieve all of its rows. You might want to consider only expanding the first root node, since it looks like that is the only one you are searching under.