Hello!
I have a problem. When I bind data to ultratree with SetDataBinding() I do not know how to set KeyValue of each node. Nodes are created automatically. The problem is because I want to search for a node with GetNodeByKey() method and I have no key values set for nodes.
How can you specifiy ParentKeyValue that hierarchical tree can be created via data binding ?
Thank you
Gregor
What you can do is handle the InitializeDataNode event and set the node's Key.
Yes thank you. It works and I get node with desired key. But when I want to set checkbox in a column of the returned node CheckState on UI is not changed. I do not know why ? Here is the code.
UltraTreeNode node = tvDiagnosisType.GetNodeByKey(Convert.ToString(diagnosisTypeID));
if (node != null)
(node.Cells["Selected"].Column.Editor as CheckEditor).CheckState = CheckState.Checked;
Thank you, Regards, Gregor
Thank you. Now it works.
filejg said:I want to tell you as well that when I change Editor CheckState value of a cell CheckState value is actually changed.
If you have bound the tree to a DataTable, each node's ListObject property will return an object of type DataRowView, which exposes a Row property. That property returns a reference to the underlying DataRow.
Hmm. Thank you for your answer. It is very helpful to me. I want to tell you as well that when I change Editor CheckState value of a cell CheckState value is actually changed.
I have one more question. I am sorry if question is stupid but can you give me tip on how to access underlying DataRow of a UltraTreeNode ?
Thank you very much
Regards, Gregor
The fact that doing that doesn't cause an exception is probably a bug - you should not be able to set an editor's value when it isn not in edit mode, and setting the CheckState on the CheckEditor is essentially doing just that. What you need to do is get a reference to the underlying DataRow (I am speculating here that you are bound to a data source) and set the value on the corresponding cell on the DataRow.