private void LoadRootNodes()
{
UltraWebTree1.ClearAll();//清空显示
dvR.RowFilter="Class=1";//用到datareader的过滤功能
foreach(DataRowView dr in dvR)
{
string McR=dr["Name"].ToString();
int IDR=Convert.ToInt32(dr["ID"].ToString());
Infragistics.WebUI.UltraWebNavigator.Node //定义节点类型
RootNode=UltraWebTree1.Nodes.Add(McR,IDR); //在指定的节点上添加节点
LoadChildNodes(RootNode,IDR);
}
}
private void LoadChildNodes(Infragistics.WebUI.UltraWebNavigator.Node ParentNode, int
ParentNodeId)//需要得到节点类型和id值,一一对应
{
DataView dvC=new DataView();
dvC.Table=ds.Tables["Bumen"];
dvC.RowFilter="Former="+ParentNodeId;
foreach(DataRowView drc in dvC)
{
string McC=drc["Name"].ToString();
int IDC=Convert.ToInt32(drc["ID"].ToString());
Infragistics.WebUI.UltraWebNavigator.Node ChildNode
=ParentNode.Nodes.Add(McC,IDC);
LoadChildNodes(ChildNode,IDC);//递归调用
}
}