Maybe it's just me.. But for the life of me, I cannot find how to add a LeftImage to a child node.
I'm adding a child node thru aNode.Nodes.Add(), but can seem to find where to assign an image.
Thanks.
hi,
I am not very sure weather i have got ur question correctly but it may help u ...
ChildNode.LeftImages.Add(Image)
Fordisplaying the Image in Cells of the node u can add the image
Cell.Appearance.Image = Image.
regards,
ravi
Thanks for info, I know what your describing, but that doesn't work.
Using a DataSet with a DataRelation for your data.
Create an UltraTreeNode (UltraTreeNode aNode)
While in a foreach()
Add the parent node with : aNode= tree.Nodes.Add(....);
While in a secondary foreach(datarow with getchildrows)
add the child nodes using aNode.Nodes.Add(key, display value);
I don't see anything like; aNode.Nodes.LeftImages.Add(image); that will add a leftimage to the child node.
I CAN access aNode.LeftImages.Add(image), but this sets the Node Image on the PARENT, not the child...
Hi,
U can achive this in following ways..
1) Instead of using the aNode.Nodes.Add(key, display value); Create the node first, Add the Left Images to the newly created node and the Add the newly Created Node to the parentNode.
UltraTreeNode ChildNode = new UltraTreeNode(Key, "Text");
ChildNode.LeftImages.Add(Image);
aNode.Nodes.Add(ChildNode );
2. You can retrive the ChildNode by key from the Ultratree, then assign the imgaes to the referance object.
Hope this will resolve ur issue.
ravi.
aNode.Nodes is a collection of nodes, not a single node. So that's why it doesn't have a LeftImages property. To get the LeftImages, you would have to reference a node in the collection like aNode.Nodes[0].LeftImages.
If you are binding the tree to a data source, then another way to do this that is more efficient than looping. You can use the InitializeDataNode event. This event passes you the node being created from the data source. This is more efficient because these nodes are created lazily, so you won't be forcing the tree to create nodes that might never be needed.
Ok.. I went back and changed my bind to use the SetDataBinding methods and by reordering my Select statement in my SQL SP, I can see what I want displayed and can use the InitializeDataNode methods to customize each node level..
Now, last question... Where are my keys??? I can't open my data windows without knowing my selected node key... The bind does not set them, I can't find anything to define them....
You can't use the Key property of the node, you have to get it from the data in the row. You can probably do something like node.Cells["Key"].Value, assuming that the ColumnSet is set up to display the key value or at least create a column for it. If not, then you can still get the key, but you have to get it from the data, rather than the node. The node exposes a ListObject property which will return you the underlying data object from the data source, so you can access any data you need from there.