|
本帖最后由 feitian78 于 2015-7-8 09:14 编辑
protected void LoadTreeView(long ParentID, FineUI.TreeNode pNode, DataSet ds)
{
DataRow[] Rows = ds.Tables[0].Select("Parid=" + ParentID, "OrderID");
foreach (DataRow Row in Rows)
{
if (pNode == null)
{
//添加根节点
FineUI.TreeNode node = CreateNode(Row);
this.Tree1.Nodes.Add(node);
LoadTreeView(Convert.ToInt32(Row["ID"]), node, ds);
// node.Expanded = true;
}
else
{
FineUI.TreeNode node1 = CreateNode(Row);
pNode.Nodes.Add(node1);
LoadTreeView(Convert.ToInt32(Row["ID"]), node1, ds);
// pNode.Expanded = true;
}
}
}
FineUI.TreeNode CreateNode(DataRow Row)
{
FineUI.TreeNode node = new FineUI.TreeNode();
node.Text = Row["MName"].ToString();
node.NodeID = Row["ID"].ToString();
node.EnableCheckBox = true;
node.EnableCheckEvent = true;
if (Row["MID"].GetType() != typeof(System.DBNull))
{
node.Checked = true;
}
return node;
}
用上面的方法创建节点后
用string[] nodeIds = Tree1.SelectedNodeIDArray;得不到被选中的节点求解貌似用Tree1.GetCheckedNodeIDs,哎还是
|
|