2 xiaozhangone xiaozhangone 于 2016.02.23 14:13 提问

Node.Expand(); 这个方法为什么前台显示还是没有展开

请高手帮忙解决,代码如下:
public static void CheckTreeNode(string FID, TreeNodeCollection nodes)
{
DataTable dt = Table_FeatMenu_Query();
DataView dvTree = new DataView(dt);
dvTree.RowFilter = "[parent_id] = " + FID;
foreach (DataRowView Row in dvTree)
{
TreeNode Node = new TreeNode();// 添加节点
Node.Text = Row["Feat_name"].ToString();
Node.Tag = Row["Feat_id"].ToString().Trim();
if (Row["type"].ToString() == "Group")
{
Node.ForeColor = System.Drawing.Color.Red;
Node.ImageIndex=5;
Node.Expand();
}
if (Row["type"].ToString() == "Menu")
{
Node.ForeColor = System.Drawing.Color.Blue;
Node.ImageIndex = 6;
**** Node.Expand();****
}
if (Row["type"].ToString() == "Button")
{
Node.ForeColor = System.Drawing.Color.RoyalBlue;
Node.ImageIndex = 18;
}
nodes.Add(Node);
CheckTreeNode(Row["Feat_id"].ToString(), Node.Nodes); //再次递归
}
}

1个回答

bdmh
bdmh   Ds   Rxr 2016.02.23 14:14

你要先添加childnodes后,再用expand展开

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!