TreeList 绑数据 跑出来的结果
下面是代码
///<summary>
/// treeList绑定
///</summary>
private void TreeListBind(string Rit_RID)
{
DataTable dt = m_RightBiz.GetModelList(Rit_RID, Rit_RIDLength);
treeList1.ClearNodes();
treeList1.BeginUnboundLoad();
TreeListNode Node = null;
foreach (DataRow row in dt.Rows)
{
Node = treeList1.AppendNode(new object[] { row["Rit_RName"] }, 0);
Node.Tag = true;
// GetCentralChild(tn,row["Rit_RID"]);
}
treeList1.EndUnboundLoad();
treeList1.ExpandAll();
}
try
{
RestService service = new RestService();
List<UMS_BASE_出品类别表> categories = service.SelectGoodsCategory(this.Login.Storeguid);
if (categories != null)
{
TreeNode root = new TreeNode(this.Login.StoreName);
foreach (UMS_BASE_出品类别表 item in categories)
{
if (categories.Contains(item) && item.父GUID == this.Login.Storeguid)
{
TreeNode node1 = new TreeNode(item.类别);
node1.Value = item.GUID.ToString();
root.ChildNodes.Add(node1);
foreach (UMS_BASE_出品类别表 item2 in categories)
{
if (categories.Contains(item2) && item2.父GUID == item.GUID)
{
TreeNode node2 = new TreeNode(item2.类别);
node2.Value = item2.GUID.ToString();
node1.ChildNodes.Add(node2);
}
}
}
}
this.tvwCategory.Nodes.Clear();
this.tvwCategory.Nodes.Add(root);
this.tvwCategory.ExpandAll();
}
}
catch (Exception ex)
{
AjaxalertMessage.AjaxAlert(UpdatePanel1, ex.Message);
}
不是 TreeView 是TreeList
是用TreeListNode 对象创建节点的!!
@爬上墙头等红杏。: 只是对象的属性不一样,意思和做法都是一样的。你稍微变通一下就是的了。
你要添加一个列才可以!
在你的TreeListNode上面添加一个列才可以显示内容,不添加列显示不了的!