实体类

public class TreeListTest
{
public int ID { get; set; }

public int PARENTID { get; set; }

public string NAME { get; set; }
}

实例化数据

List<TreeListTest> list = new List<TreeListTest>();

list.Add(new TreeListTest {
ID=1,
PARENTID=1,
NAME="宝马"
});
list.Add(new TreeListTest
{
ID = 2,
PARENTID = 1,
NAME = "宝马x5"
});

list.Add(new TreeListTest
{
ID = 3,
PARENTID = 3,
NAME = "奔驰"
});

list.Add(new TreeListTest
{
ID = 4,
PARENTID = 3,
NAME = "奔驰c200"
});

this.treeList1.DataSource = list;
this.treeList1.KeyFieldName = "ID";
this.treeList1.ParentFieldName = "PARENTID";
this.treeList1.Columns[0].Caption = "测试";

 

相关文章:

  • 2021-06-01
  • 2022-02-08
  • 2021-06-07
  • 2021-05-25
  • 2022-03-05
  • 2022-12-23
  • 2021-07-19
猜你喜欢
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-05-16
  • 2021-09-25
  • 2022-12-23
  • 2022-02-11
相关资源
相似解决方案