鼠标右键实现添加,删除treeview节点(内有怎么样动态生成树的代码.包括数据库表)

ltmltm123456 2007-04-06 01:07:33
前几天解决了 怎么样动态生成树的问题..
今天问题又来了
老师叫我用鼠标右键实现添加,删除,节点.详细一点的就是:当点击任意一个节点的时候,然后用鼠标右键弹出一个菜单,上面有这些更新的操作.

我估计的是 先要实现 这几个更新的操作... 然后在实现这个鼠标右键的功能然后把那个添加,删除功能添加进去..
不知道这个想发对不....
还有就是请各个大侠给我点添加,删除树节点的2003vs的代码...
再告诉下实现这个鼠标右键的功能的方法...
下在我把我动态生成树的代码给贴出来..给那些还有不会的生成树的..仅供参考..
...全文
536 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
ltmltm123456 2009-01-03
  • 打赏
  • 举报
回复
虽然每天很苦,但却很充实。短短的几周过的太

快了,在trainer的细心指导,同事的关心中,我很快的进入了项目中。有了一些基本技能,再加上XX里的leader,mentar 还有其它的同事

的关心,我开始接触真正的项目。每天看着一行一行规范的代码,感到非常的佩服这些前辈们。从那时起我就有了新的目标,向他们好好学

习。所以在每一个工作日,在处理每份工作的同时,也仔细的阅读前辈们的思想。回想起这么过月来,发现自己也真的学了很多,从

XXserver 到client 每个地方都有我学习的地方。作为一个新人,特别是没有经验的新人能有这么好的机会,我感到已经万分荣幸了。有的

时候也在看一下一些技术书籍,慢慢的提升自己。争取在一年里能自己独立处理工作上的事。两到三年里做一名优秀的职员。
ltmltm123456 2009-01-03
  • 打赏
  • 举报
回复
好文章:

In a flash, half of year has passed, This period of my life in precious experience that lefts a good and brilliant meory to me. During this period, you give me enough tolerance, support and assistance, let me have a chance to become one of XXX.
Under Leader and workmate’s care and direction, I am unremitting efforts, all achieved have a certain progress, I will now do the work of the report are as follows.
1, Through theoretical study and project experience, there is more in-depth understanding for the development of software. From two weeks training to the real project, each stage is the experience I have never experienced. In the training, the pressure is very heavy, but not the workload, and also competition, at the same time, I feel I am improving every day; I feel I am changing from gradually to company's staff.
Of course,over the past six months,I have a lot of inadequacies,because I did not adhere to the objectives of each in the End. For example, English,on this subject,I did not work hard to learn. Now, though there are somewhat improved, but still not good enough Compared with other colleagues.so in the next year,I would hold on speaking english without working time.i will reading articles everyday,to help me to raise the volume of words.I believe,if I hold on every day, I will be able to show off next year today.
Without the technical know-how,english proficiency,I learned a lot of ways to getting along better with everyone.learned how to Strengthen team spirit.and how to Strengthen the Efficiency.a lot of people give me a hand in the past six months. My colleagues are very cordial in the project.there spirit of helping other people happiness is influence all of us.I thank this is the best way to delivery the Corporate culture. I sincerely hope they have a good health.Thanks for them.
ltmltm123456 2009-01-03
  • 打赏
  • 举报
回复
好文章:

In a flash, half of year has passed, This period of my life in precious experience that lefts a good and brilliant meory to me. During this period, you give me enough tolerance, support and assistance, let me have a chance to become one of XXX.
Under Leader and workmate’s care and direction, I am unremitting efforts, all achieved have a certain progress, I will now do the work of the report are as follows.
1, Through theoretical study and project experience, there is more in-depth understanding for the development of software. From two weeks training to the real project, each stage is the experience I have never experienced. In the training, the pressure is very heavy, but not the workload, and also competition, at the same time, I feel I am improving every day; I feel I am changing from gradually to company's staff.
Of course,over the past six months,I have a lot of inadequacies,because I did not adhere to the objectives of each in the End. For example, English,on this subject,I did not work hard to learn. Now, though there are somewhat improved, but still not good enough Compared with other colleagues.so in the next year,I would hold on speaking english without working time.i will reading articles everyday,to help me to raise the volume of words.I believe,if I hold on every day, I will be able to show off next year today.
Without the technical know-how,english proficiency,I learned a lot of ways to getting along better with everyone.learned how to Strengthen team spirit.and how to Strengthen the Efficiency.a lot of people give me a hand in the past six months. My colleagues are very cordial in the project.there spirit of helping other people happiness is influence all of us.I thank this is the best way to delivery the Corporate culture. I sincerely hope they have a good health.Thanks for them.
hanshufan 2007-04-13
  • 打赏
  • 举报
回复
学习!
ltmltm123456 2007-04-07
  • 打赏
  • 举报
回复
请问 能不能 只用c#做一个menu 出来那...
bwangel 2007-04-07
  • 打赏
  • 举报
回复
道义上支持
ltmltm123456 2007-04-07
  • 打赏
  • 举报
回复
请问 能不能 只用c#做一个menu 出来那...
ltmltm123456 2007-04-06
  • 打赏
  • 举报
回复
请问 能不能 只用c#做一个menu 出来那...
zzz6099807 2007-04-06
  • 打赏
  • 举报
回复
用javascript改变右击的menu,自己做个menu,点击连接到新页
ltmltm123456 2007-04-06
  • 打赏
  • 举报
回复
ID content parentId isLeaf
hg 韩国 0
mg 美国 0
zg 中国 0
zg.gd 广东 zg 0
zg.gd.fj 福建 zg.gd 0
zg.gd.gz 广州 zg.gd 0
zg.gd.st 珠海 zg.gd 0
zg.gd.xg 宵旰 zg.hb 0
zg.hb 湖北 zg 0

tbTree(ID ,content ,parentId ,isLeaf) 表结构..
你添加一个 treeview 和一个labal 进行了 还要该下数据库连接....
ltmltm123456 2007-04-06
  • 打赏
  • 举报
回复
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Web.UI.WebControls;
using System.Data.SqlClient;
namespace treeview
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected Microsoft.Web.UI.WebControls.TreeView TreeView1;

private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection myConn ;
myConn=new SqlConnection("server=.;database=db_cqit_1;uid=sa;pwd=''");
myConn.Open();
SqlCommand Comm=new SqlCommand("select * from tbTree",myConn);


if(!IsPostBack)
{
TreeView1.Nodes.Clear();
SqlDataReader dr=Comm.ExecuteReader();
while(dr.Read())
{

if(dr["parentId"].ToString()=="")
{
TreeNode newNode=new TreeNode();
newNode.Text = dr["content"].ToString();
newNode.ID = dr["ID"].ToString();
TreeView1.Nodes.Add(newNode);
InitTree(newNode.Nodes, dr["ID"].ToString());
}
}
}//根接点是NULL
myConn.Close();
// 在此处放置用户代码以初始化页面
}
private void InitTree(TreeNodeCollection Nds,string parentId)
{
SqlConnection myConn ;
myConn=new SqlConnection("server=.;database=db_cqit_1;uid=sa;pwd=''");
myConn.Open();
SqlDataAdapter da=new SqlDataAdapter("select * from tbTree",myConn);
DataSet ds=new DataSet();
da.Fill(ds);
myConn.Close();
DataRow[] rows;
rows=ds.Tables[0].Select("parentId='"+parentId+"'");
TreeNode temNd;
foreach(DataRow row in rows)
{
temNd=new TreeNode();
temNd.ID=row["ID"].ToString();
temNd.Text=row["content"].ToString();
Nds.Add(temNd);
InitTree(temNd.Nodes,temNd.ID);
}
}

#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.TreeView1.SelectedIndexChange += new Microsoft.Web.UI.WebControls.SelectEventHandler(this.TreeView1_SelectedIndexChange);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void TreeView1_SelectedIndexChange(object sender, Microsoft.Web.UI.WebControls.TreeViewSelectEventArgs e)
{
TreeNode NewNode=TreeView1.GetNodeFromIndex(e.NewNode);
string strNodeId=NewNode.Text ;
Label1.Text=strNodeId;

}


}
}

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧