• TreeList结构及数据绑定


    实体类

    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 = "测试";

  • 相关阅读:
    网络面试题2
    网络
    Linux os
    操作系统面试题2
    操作系统面试题
    Linux
    算法-字符全排列
    第k大数问题
    地址
    ListView里面嵌套CheckBox
  • 原文地址:https://www.cnblogs.com/yourSixUncle/p/9922370.html
Copyright © 2020-2023  润新知