I am having problems adding data to the UltraTree when the view style is in outlook express. I think the problem is that I am not quite sure how to use the UltraTreeColumnSet. Are there examples in adding data to the ultra tree?
Below is a snippet of my code, the error occurs in the bold line where I am setting the cell value for a child node. I am able to set the cell value of the parent node, but I get an error for the child node. I get a runtime error "Object reference not set to an instance of an object"
DataTable dataTable = InitializeTable(); UltraTreeColumnSet rootColumnSet = InitializeColumnSet(); ultraTree.Nodes.Clear(); UltraTreeNode rootNode = ultraTree.Nodes.Add(id+ "_" + index); rootNode.Text = id; rootNode.SetCellValue(rootColumnSet.Columns["Id"],id); rootNode.SetCellValue(rootColumnSet.Columns["Description"], "description"); rootNode.SetCellValue(rootColumnSet.Columns["EU"], "EU"); UltraTreeNode childNode = new UltraTreeNode("childNode"); try { childNode.Text = "hello"; childNode.SetCellValue(rootColumnSet.Columns["Id"], "hello"); childNode.SetCellValue(rootColumnSet.Columns["Description"], "desc"); childNode.SetCellValue(rootColumnSet.Columns["EU"], "eu"); } catch (Exception e) { MessageBox.Show(e.Message); } rootNode.Nodes.Add(childNode);
private UltraTreeColumnSet InitializeColumnSet() { DataTable dataTable = InitializeTable(); UltraTreeColumnSet rootColumnSet = ultraTree.ColumnSettings.RootColumnSet; foreach (DataColumn dataColumn in dataTable.Columns) { UltraTreeNodeColumn column = rootColumnSet.Columns.Add(dataColumn.ColumnName); column.DataType = dataColumn.DataType; } return rootColumnSet; } private DataTable InitializeTable() { // Create a DataTable DataTable dataTable = new DataTable(); // Add some columns dataTable.Columns.Add( "Id", typeof(string) ); dataTable.Columns.Add( "Description", typeof(string) ); dataTable.Columns.Add( "EU", typeof(string) ); return dataTable; }
Any help is appreciated!!
Jaime
I figured out the problem. The problem was with using the override.columnSet
Can you elaborate on how you fixed this problem, I am not getting an error when setting the values however when I run the application none of the columns are displayed. I have set the RootColumnSet as the Column Set that I want and I can add the values of the cells and the nodes just fine but when displaying it looks like a standard treeview instead of an outlookstyle treeview and the values of the cells are not being displayed.
It sounds like you need to set the Style property of the tree to Grid or OutlookExpress.
Sorry Mike,
My query is different from the above one.
We have UltraExplorer bar and different Ultra tree controls. There are 2 issues
1. After loading, it seems that Infragistics controls (UltraTree) taking too much memory..So is there any way to reduce the memory.
2. When click on Ultra Explorer bar, it shows the Ultra Tree with some nodes, and again click on Ultra Explorer bar which explores other Ultr Tree with some nodes. HERE, the memory is not getting reduced, it is increased as and when click on Ultra Explorer bar...Is there any way to reduce the memory.
Thanks
Shri
Hi Shri,
shridnypaw said:1. After loading, it seems that Infragistics controls (UltraTree) taking too much memory..So is there any way to reduce the memory.
That depends on why it's using too much memory. How do you know how much memory the tree is using? Why is it too much? Too much for what?
Without knowing what you are doing with the tree and what is using the memory, I cannot even guess how you might reduce it - the possibilities are literally infinite.
shridnypaw said:2. When click on Ultra Explorer bar, it shows the Ultra Tree with some nodes, and again click on Ultra Explorer bar which explores other Ultr Tree with some nodes. HERE, the memory is not getting reduced, it is increased as and when click on Ultra Explorer bar...Is there any way to reduce the memory.
Once again, the answer to this depends on a huge number of factors and it's all information I don't have. My guess is that your code is creating objects that you are not disposing. Or that the memory has been released and simply hasn't been reclaimed by the garbage collector.
But without specific samples to demonstrate these issues to see what is actually happening, there's no way I can even guess.