Add Values to a Row of TreeList of DevExpress
Add Values to a Row of TreeList of DevExpress
I am creating an application and used a TreeList of DevExpress.
Currently, I am the one who created the nodes of TreeList in the node editor and planned that all data will be read or transferred in my TreeList by adding it to the specified column.
How could I achieve this?
Here is my code
tbl.Rows.Add(4, 4, 10 );
tbl.Rows.Add(5, 5, 30);
but it doesn't work at all. I'm just getting an exception.
Hav you checked out DevExpress ?
– Jens Kloster
Mar 19 '13 at 17:37
Why don't you contact DX directly?
– Mikhail
Mar 19 '13 at 19:29
1 Answer
1
Devexpress controls work differently than the built-in winforms controls.
Here's an example on how you could add items to your TreeView
in an unbound manner:
TreeView
using DevExpress.XtraTreeList.Columns;
using DevExpress.XtraTreeList.Nodes;
public class Form1
{
private void Form1_Load(System.Object sender, System.EventArgs e)
{
TreeList1.Columns.Clear();
TreeListColumn newColumn = TreeList1.Columns.Add();
newColumn.Caption = "Tree Column";
newColumn.Visible = true;
TreeList1.Nodes.Clear();
TreeListNode rootNode = TreeList1.Nodes.Add({ "Root Node" });
TreeListNode child1 = rootNode.Nodes.Add({ "Child 1" });
child1.Nodes.Add({ "GrandChild 1.1" });
child1.Nodes.Add({ "GrandChild 1.2" });
TreeListNode child2 = rootNode.Nodes.Add({ "Child 2" });
child2.Nodes.Add({ "GrandChild2.1" });
child2.Nodes.Add({ "GrandChild2.2" });
child2.Nodes.Add({ "GrandChild2.3" });
TreeList1.RefreshNode(rootNode);
}
}
If you need more code samples, click below - you'll find plenty of them there:
http://documentation.devexpress.com/#WindowsForms/CustomDocument5558
Thank you for answering.. how could i achieve this having a database..? what is the process to deal with?
– JM Olesco
Mar 23 '13 at 16:10
The link is posted above in my answer should put in you in the right direction. What have you tried so far?
– J.Hudler
Mar 24 '13 at 13:56
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
What exception does it give you..? we are not mind readers here
– MethodMan
Mar 19 '13 at 17:33