我在数据库中有一个表,其列如下:
CategoryId
CategoryName
ParentCategoryId
CategoryPath
只有当CategoryPath
它是子元素时才会有值。现在要填充树视图列表,我编写了以下代码:
DataTable dt = d.CategoryGet(new System.Collections.Hashtable());
treeList1.DataSource = dt;
treeList1.KeyFieldName = info.CategoryParameters.CategoryId.ToString();
treeList1.ParentFieldName = info.CategoryParameters.ParentCategoryId.ToString();
treeList1.PopulateColumns();
treeList1.BestFitColumns();
treeList1.ExpandAll();
treeList1.FocusedNode = treeList1.Nodes[0];
对于该CategoryPath
列,我想添加一个图像,该图像将打开文件对话框,用户可以从中选择文件名,完整路径将保存在数据库中。
您能否建议该怎么做,以便在有路径的位置出现在列中,并与图像按钮一起更改路径;当用户想要为尚未指定路径的子元素分配新路径时,该图像也应该出现。
任何帮助将非常感激。