Selected Item in Treelist


Author
Message
Ignacio Mendiguren
Ignacio Mendiguren
Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)
Group: Forum Members
Posts: 20, Visits: 1
Hi,


I am new to Nevron components and am working with the treelist.
I wonder what is the way to get the selected item from the treelist?

Thanks,

IM
Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Ignacio,

NTreeList control you can select the whole row which is represented by NTreeListNode.
Therefore you can get the selected node(s), not node's subitems.

You can obtain the selected node by SelectedNodes property.

Here is a small example:

//Filling NTreeList with some data.

NTreeListColumn column0 = new NTreeListColumn();
NTreeListColumn column1 = new NTreeListColumn();

nTreeList1.Columns.Add(column0);
nTreeList1.Columns.Add(column1);

for (int i = 0; i < 5; i++)
{
    NTreeListNode node = new NTreeListNode();
   
NTreeListNodeStringSubItem item0 = new NTreeListNodeStringSubItem("Item 0" + i.ToString());
    item0.Column = column0;

   
NTreeListNodeStringSubItem item1 = new NTreeListNodeStringSubItem("Item 1" + i.ToString());
    item1.Column = column1;

    node.SubItems.Add(item0);
    node.SubItems.Add(item1);

    nTreeList1.Nodes.Add(node);
}

After select some nodes you can get them as follows:

NTreeNode[] selectedNodes = nTreeList1.SelectedNodes;

Since, the array items are of type NTreeNode you should cast to NTreeListNode to get node's subitems.



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search