Treeview怎么动态为父节点添加子节点
#regionMySQLControlData_mydata=newMySQLControlData();IList_myfgroup=newArrayList();_m...
#region
MySQLControlData _mydata = new MySQLControlData();
IList _myfgroup = new ArrayList();
_myfgroup = Public._sys.GetFGroutList();
//_myfgroup = _mydata.GetFriendList(" and uid=" + Public.UserLogonInfo.U_SnsId, "8", out _fuids);
//this.label1.Text += "下面是我的好友列表:\r\n";
tv_flist.BeginUpdate();
tv_flist.Nodes.Clear();
//tv_flist.Nodes.Add(_mydata.GetfGroupName(_mf.gid));
for (int i = 0; i < _myfgroup.Count; i++)
{
TreeNode tn; //建立treeview的节点
tn = new TreeNode(_myfgroup[i].ToString());
tv_flist.Nodes.Add(tn);
#region 增加二级节点
IList _myflist = new ArrayList();//好友列表
_myflist = Public._sys.GetFriendList(i.ToString(), Public.UserLogonInfo.U_SnsId.ToString());
for (int k = 0; k < _myflist.Count; k++)
{
CMS_Friend _mf = new CMS_Friend();
_mf = (CMS_Friend)_myflist[i];
//增加二级节点
TreeNode child = new TreeNode();
}
#endregion
}
tv_flist.EndUpdate();
#endregion 展开
MySQLControlData _mydata = new MySQLControlData();
IList _myfgroup = new ArrayList();
_myfgroup = Public._sys.GetFGroutList();
//_myfgroup = _mydata.GetFriendList(" and uid=" + Public.UserLogonInfo.U_SnsId, "8", out _fuids);
//this.label1.Text += "下面是我的好友列表:\r\n";
tv_flist.BeginUpdate();
tv_flist.Nodes.Clear();
//tv_flist.Nodes.Add(_mydata.GetfGroupName(_mf.gid));
for (int i = 0; i < _myfgroup.Count; i++)
{
TreeNode tn; //建立treeview的节点
tn = new TreeNode(_myfgroup[i].ToString());
tv_flist.Nodes.Add(tn);
#region 增加二级节点
IList _myflist = new ArrayList();//好友列表
_myflist = Public._sys.GetFriendList(i.ToString(), Public.UserLogonInfo.U_SnsId.ToString());
for (int k = 0; k < _myflist.Count; k++)
{
CMS_Friend _mf = new CMS_Friend();
_mf = (CMS_Friend)_myflist[i];
//增加二级节点
TreeNode child = new TreeNode();
}
#endregion
}
tv_flist.EndUpdate();
#endregion 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询