DevExpress TreeList 自动加载数据

来源:互联网 发布:物流网络的若干特性 编辑:程序博客网 时间:2024/05/16 08:30

C# Code:


public void BindData()
        {
            
            try
            {
                string sql = "SELECT * from t_Material_Class";                
                DataTable dt = Maticsoft.DBUtility.DbHelperSQLite.Query(sql).Tables[0];

                treeList1.Nodes.Clear();
                treeList1.ParentFieldName = "fParent_Id";
                treeList1.KeyFieldName = "fId";
                treeList1.OptionsBehavior.Editable = false;
                treeList1.DataSource = dt;


                treeList1.Columns["fName"].VisibleIndex = 0;
                treeList1.Columns["fName"].Caption = "名称";
                treeList1.Columns["fRemark"].Caption = "备注";


                treeList1.ExpandAll();
            }
            catch (Exception ex)
            {
            }
        }

0 0
原创粉丝点击