手动为treeview添加节点

protected void Page_Load(object sender, EventArgs e)
{
TreeNode root = new TreeNode("河北软件职业技术学院","0");//定义一个根节点
root.NavigateUrl = "http://www.hbsi.com.cn/";
TreeNode softdipartment = new TreeNode("软件工程系", "1001");
softdipartment.NavigateUrl = "http://221.192.237.88:8001/rjx";
root.ChildNodes.Add(softdipartment);//将子节点添加到父节点中
TreeNode netdirection = new TreeNode("net","1002");
netdirection.NavigateUrl = "http://221.192.237.88:8001/rjx/newsDetails/294/8/0.html";
softdipartment.ChildNodes.Add(netdirection);//将子节点添加到父节(softdipartment)点中
this.TreeView1.Nodes.Add(root);//将根节点添加到treeview中(就将根节点及子节点都装到了treeview中)
}

也可以在设计界面编辑节点;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值