62,267
社区成员
发帖
与我相关
我的任务
分享
TreeNode stn = tn.Parent;
TreeNode tno = stn.ChildNodes[0];
tn.ChildNodes.Clear();
int index = stn.ChildNodes.IndexOf(tn);
stn.ChildNodes.Remove(tn);
if (tn.Value != tno.Value)
{
stn.ChildNodes.Remove(tno);
}
commList = new OrgDal().getOrgsComm(" where station='" + tn.Value + "'");
for (int x = 0; x < commList.Count; x++)
{
if (commList[x].StationId == tn.Value)
{
TreeNode childnodeCom = new TreeNode();
childnodeCom.Text = commList[x].Orgname;
childnodeCom.Value = commList[x].Orgid;
childnodeCom.SelectAction = TreeNodeSelectAction.Select;
tn.ChildNodes.Add(childnodeCom);
}
}
if (tn.Value != tno.Value)
{
stn.ChildNodes.AddAt(0, tno);
}
stn.ChildNodes.AddAt(index, tn);
tn.ChildNodes.Clear();
commList = new OrgDal().getOrgsComm(" where station='" + tn.Value + "'");
for (int x = 0; x < commList.Count; x++)
{
if (commList[x].StationId == tn.Value)
{
TreeNode childnodeCom = new TreeNode();
childnodeCom.Text = commList[x].Orgname;
childnodeCom.Value = commList[x].Orgid;
childnodeCom.SelectAction = TreeNodeSelectAction.Select;
tn.ChildNodes.Add(childnodeCom);
}
}