使用dev的TreeView控件显示树型图,SQL语句如下:
strSql = string.Format("SELECT id,name,parentId,sortId FROM {0} ORDER BY sortId ASC", strTable);
。。。。。。
treeList1.KeyFieldName = "sortId";//主键列,不能有重复值,否则报错
treeList1.ParentFieldName = "parentId";//父节点列
控件中会同时显示id列及name列。隐藏id列的办法:
treeList1.Columns.ColumnByFieldName("id").Visible = false;//隐藏id列