I'm trying to select a node in TreeListLookupEdit.
var fn = treeListLookupEdit1.FindNodeByKeyID(NodeId);
treeListLookupEdit1.Properties.TreeList.FocusedNode = fn;
My TreeListLookupEdit is already filled with the data (from an EF datasource), I need to focus the desired row and see this value in both treeListLookUpEdit1.Text (when it is in a closed state) and when I open a popup window too.
But nothing happens, it does not selects the node.
I've also tried this (Where "treeNodes" is the actual TreeList inside the TreeListLookupEdit):
treeNodes.FocusedNode = fn;
But, when I run this piece of code, it works:
treeListLookupEdit1.ShowPopup();
treeListLookupEdit1.Properties.TreeList.FocusedNode = fn;
treeListLookupEdit1.ClosePopup();
So, how to avoid using the ShowPopup?
Update It seems, you should set EditValue
treeListLookupEdit1.EditValue = NodeId
You need to set up
TreeListLookUpEdit.Properties.DisplayMemberproperty andTreeListLookUpEdit.Properties.ValueMemberproperty.Set the
TreeListLookUpEdit.Properties.DisplayMemberproperty to the column that you want to display in yourTreeListLookupEditandTreeListLookUpEdit.Properties.ValueMemberto ID column and useTreeListLookUpEdit.EditValueto focus node.After that you can do something like this:
Here is example with
DataTableas data source:If you set
EditValueproperty of thistreeListLookUpEditobject for example to 5 then you will see "1.2" text in control and node with such text will be focused: