社区
C#
帖子详情
treeview问题 ~!!!!大家来HELP ME 谢谢
qqws
2003-07-26 09:44:45
看了很多TREEVIEW的帖子跟资料,还是没弄明白怎么动态加载数据,请高手指教下,请把过程给详细点,我刚开始学的,谢谢大家了,请关照小弟 分不够可以加
结构:
人力资源部
人员名字
财务部
人员名字
后勤部
人员名字
大楷就这样的个模式,数据试在数据库里面的,麻烦把数据库结构也告诉我,再次感谢了,急,
...全文
132
11
打赏
收藏
treeview问题 ~!!!!大家来HELP ME 谢谢
看了很多TREEVIEW的帖子跟资料,还是没弄明白怎么动态加载数据,请高手指教下,请把过程给详细点,我刚开始学的,谢谢大家了,请关照小弟 分不够可以加 结构: 人力资源部 人员名字 财务部 人员名字 后勤部 人员名字 大楷就这样的个模式,数据试在数据库里面的,麻烦把数据库结构也告诉我,再次感谢了,急,
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
11 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
jpusaddam
2004-01-08
打赏
举报
回复
http://search.csdn.net/expert/topic/52/5202/2003/3/13/1525202.htm
jeall
2004-01-07
打赏
举报
回复
Thanks! jeall@163.com
qqws
2003-07-27
打赏
举报
回复
?///???
qqws
2003-07-27
打赏
举报
回复
还是有问题啊,对了,还有个问题,我用DATAVIEW筛选了记录后,我怎么把筛选的记录副到一个字符串上去啊,
dahuzizyd
2003-07-27
打赏
举报
回复
你直接拷贝就可以用了啊
qqws
2003-07-27
打赏
举报
回复
大家再给点详细的例子把,还是不太明白
qqws
2003-07-27
打赏
举报
回复
sheng.wan@tom.com
雪狼1234567
2003-07-26
打赏
举报
回复
给我mail发一个给你
dahuzizyd
2003-07-26
打赏
举报
回复
在web下,我是使用一个全局静态变量来保存selectedIndex
string static CurrentNodeIndex ;
CurrentNodeIndex = TreeView1.SelectedNodeIndex;
另:上面的根据selectedIndex来遍历树查找节点,错了,应该是SelectNodeIndex
dahuzizyd
2003-07-26
打赏
举报
回复
我的这个和你的不太一样,人员是在另一个表里的,向你的直接象下面的结构,把人员的ParentID设为他的父节点的ID就可以了:
部门信息表:
DepID ParentID Name
100001 0 技术部
100002 0 财务部
100003 100001 编码组
100004 100001 测试组
建表的过程:需要先声明一个 DataView dv
public void InitTree(TreeNodeCollection Nds,string parentId,DataSet ds,string TableName)
{ //从根节点开始递归调用显示子树
dv=new DataView();
TreeNode tmpNd;
string intId;
dv.Table=ds.Tables[TableName];
dv.RowFilter="ParentId=" + parentId ;
foreach(DataRowView drv in dv)
{ //递归算法从这里开始。
tmpNd=new TreeNode();
tmpNd.Tag =drv[0].ToString(); //节点ID
tmpNd.Text=drv[2].ToString(); //节点名称
Nds.Add(tmpNd);
intId=drv[1].ToString(); //节点的父节点
InitTree(tmpNd.Nodes,tmpNd.Tag.ToString(),ds,TableName);
}
}
四个参数:TreeNodeCollection Nds就是你要生成的树,例如:treeView1
ParentID 父节点名称,初始时为0 后面两个我就不说了。
另外,在添加节点时判断是否已有相同名称的节点存在可以用递归:
public void GetAllNodeText(TreeNodeCollection tnc,string txt)
{
foreach (TreeNode node in tnc)
{
if( node.Nodes.Count != 0 )
GetAllNodeText(node.Nodes,txt);
}
}
我的添加节点时只判断同级节点是否有重名的:
public bool AddNode(TreeNode SelNode,string ID,string txt)
{
int exist = 0;
TreeNode NewNode = new TreeNode();
NewNode.Text = txt;
NewNode.Tag = ID;
foreach (TreeNode tnc in SelNode.Nodes )
{
if (tnc.Text == txt)
{
exist = 1;
return false;
}
}
if (exist != 1)
{
SelNode.Nodes.Add(NewNode);
return true;
}
else
{
return false;
}
}
删除就很简单了
public bool DeleteNode(TreeNode DelNode)
{
if ( DelNode.Nodes.Count == 0)
{
DelNode.Remove();
return true;
}
else
{
return true;
}
}
以上是winform下的,web应用下的你要先装上web下的treeView控件,实现方法查不多,主要是类型不一样,而且webTreeView1在添加和删除节点时,由于没有selectedNode的概念,所以要根据selectedIndex来遍历树查找节点,然后添加或删除,代码太多,就不贴上来了。
这些你可以作在一个类下,在前台界面引用,然后使用里面的方法。
qqws
2003-07-26
打赏
举报
回复
怎么没人回贴啊
TreeGrid控件及Demo源码
TreeGrid控件及Demo源码 支持Asp.net2.0,MS Ajax,Postback,CallBack(可用来加载子节点),Event(Select,Expend,Collaspe,RowCreate,RowDataBound,RowCommand),DataBind 使用方法与
TreeView
和GridView相似。 原理: 这个控件主要类与MS
TreeView
相似,包括TreeGrid、TreeGridNode、TreeGridRow三个核心类。TreeGridNode表示一个节点,可以有DataItem属性,TreeGridRow表示节点所在的行。TreeGrid当然就是包括Nodes的那个树。另外,还有TreeGridNode和TreeGridRow的集合类。 与
TreeView
区别在于不同的展现方式和视图状态管理。 TreeGrid使用GridView的展现方式和语法,并且在客户端可以控制节点的展开和折叠。与GridView的展现方式和语法需要定义Template,客户端节点的展开和折叠使用Javascript控制就可以了。 so
me
feature Support Ajax Support Postback Support Callback Support Event -- Select Edit Update Delete Support DataBind like
TreeView
Support DataBind like GirdView Support ASP.net 2.0, but this demo is 3.5, because ajax future work Data Bind from DataSource Design Mode Support A icon for this control -- who can
help
me
? Examples and Docu
me
nt Testing, if you find bugs, please tell
me
, thank you!
VB编程资源大全(英文源码 控件)
1 , vb5dialog.zipThis demonstrates how to subclass the Common Dialog Dialogs and manipulate a specific Dialog.2 , cpnl.zipForm_Taskbar is a control for Visual Basic which, once placed onto a form, makes the form act like the Taskbar (minus the Start
Me
nu).3 , vbo_progbar.zipImple
me
nt a common control progress bar with added features that are not accessable using COMCTL32.OCX! 4 , vbo_infolabel.zipThis control adds a great user-friendly interface with and icon and "Hover" ability. Based on a control seen in ICQ. 5 , vbo_checkcombo.zipAdd a checkbox to a combo box and use it to enabled/disable the combo! or whatever you would like to do with it! 6 , vbo_controlfra
me
.zipCreate your own system button such as a Maximize, Minimize, Close, and many others with ease! 7 , vbo_ctextbox.zipThis class makes using the Textbox or Edit class API simple. Easily set properties and access many features not available directly from VB. 8 , taskbar.zipForm_Taskbar is a control for Visual Basic which, once placed onto a form, makes the form act like the Taskbar (minus the Start
Me
nu).9 , NT_Service.zipThis is an OCX that allows you to create an NT service application...add the control to your project and register it as a service!!10 , Scroller.zipThis is a Control Container, it's like a fra
me
control but it lets you scroll the content up and down...11 , TrayArea.zipThis control lets you add your icon to the System Tray Area and handle so
me
events such as MouseMove, MouseDown, MouseUp and DblClick.12 , Resizer.zipThis is a very useful control: It's a container control, you can insert two controls inside and then you'll have a vertical (or horizontal) resizer bar (like the Windows File Explorer). A resizer can contain another resizer... an so on. (you can divide you form in as many sizable sections as you want...).13 , Label3D.zipTh
SSM后台管理系统开发实战
课程结束之后希望大家能做到独立进行开发项目的目的,增强解决
问题
的能力,具备功能落地实现的能力。 三、课程涉及知识点 SpringMVC源码分析 Mybatis源码分析 通用Mapper Mysql数据库 Redis缓存实现 ActiveMQ消息...
EhLib 5.65.6.20 for XE2
Note that Delphi IDE does not move components to the new default place on components palette when you install new version of sa
me
component(s). So if you already has EhLib installed, then installation new (3.0) version does not move EhLib components to the 'EhLib' page. To force Delphi IDE to move compontes to the default place on components palette do next: Open
me
nu: Component->Configure Palette. Select '[All]' line in Pages listbox. Click 'Default Pages' button. 4. Installation
Help
----------------- 1. This version of library doesn't have
help
files for Delphi8 and Delphi2005. 2. Delphi 4.x - 7.x: Copy the EhLib.hlp and EhLib.cnt files to the Delphi
HELP
subdirectory. Select
Help
|Customize to start the Open
Help
application. Add the EhLib.cnt file to the Contents page, add the EhLib.hlp file to the Index and Link pages. 3. C++Builder 4.x - 6.x: Copy the EhLib.hlp and EhLib.cnt files to the C++Builder
HELP
subdirectory. Select
Help
|Customize to start the Open
Help
application. Add the EhLib.cnt file to the Contents page, add the EhLib.hlp file to the Index and Link pages. 5. Demonstration Programs ---------------------- Demonstration programs use tables from the DEMOS directory and BDE alias "DBDEMOS". DEMOS/DEMO1 - Demonstration of use TDBGridEh, TPrintDBGridEh, TDBLookupComboboxEh and TPreviewBox. Requare EhLibBDE.Pas file from DataService directory DEMOS/DirTree - Demonstration of use TDBGridEh and T
Me
mTableEh in tree-view mode. DEMOS/IbDemo - Demonstration of use T
Me
mTableEh, TBDEDataDriverEh. DEMOS/MasterDetailType3 - Demonstration of master/detail relation for T
Me
mTableEh component. DEMOS/SQLDataDriver - Demonstration of use TSQLDataDriver. DEMOS/
TreeView
- Demonstration of use TDBGridEh and T
Me
mTableEh in tree-view mode
SkinEngine3.4.7
SkinEngine3.4.7 SkinEngine is an VCL library that allows you to dynamically change almost any aspect of the visual appearance your project's forms or controls. SkinEngine provides you with full support for application skins. Skins support for forms,
me
nus and controls. SkinEngine using the internal skin files for provide new visual appearance for your project's. Also SkinEngine include powerful tools for create your own skins - SkinBuilder. # What's New in SkinEngine 3.4.7 # + Fixed: GDI resource leaks on TSeCustomForm + Fixed: SeBitmapLink
me
mory leaks + Fixed: Scrollbars not hide in
Me
mo, ListView,
TreeView
, ScrollBox # Technical Support # Technical support for KSDev software is provided through email and newsgroups on our news server. For latest news and support visit KSDev's
newsgroups
. Please, address general questions to the newsgroup. To obtain technical support for any of the KSDev's products, please send an electronic mail
me
ssage to
support@ksdev.com
. Be sure to include a detailed description of the problem you are having in addition to the following information: * Version number of KSDev software * Na
me
and version number of develop
me
nt tool (i.e. Delphi 4.01) * Windows 95/98/
Me
/NT/2000/XP version (including service packs and other fixes installed), US or international, OEM or not computer information: CPU type and speed, amount of
me
mory installed description of your problem (as much information as possible to retrieve the problem) We'll try to
help
you as fast as possible, usually in one or two business days. # KSDev's Products # # FXLib # FXLib is an easy-to-use set of components that enables you to create amazing splash screens, form and image transition effects, using all the power of its advanced rendering engine. Over 70 families of animation and transition effects with hundreds of variations. Real-ti
me
rendering. WYSIWYG editing in both design-ti
me
and run-ti
me
, preview. # The
me
Engine # The
me
Engine is an VCL library that allows you to change almost any aspect of the visual appearance your project's forms,
me
nus and controls. The
me
Engine provides you application full the
me
s support. The
me
Engine support new Windows XP style and simulation for other Windows platform. #
Me
diaPack #
Me
diaPack allows to you create of application with cool GUI. Forms of any shape, background with bitmaps tile, gradient or plasma fill, original border with bitmaps or solid fill. Advanced multi
me
dia controls with cool background and borders.
Me
diaPack is a over 70 advanced multi
me
dia components and controls. # FreeSkinEngine # SkinEngine is an VCL library that allows you to dynamically change almost any aspect of the visual appearance your project's forms or controls. In short, it provides you with full support for application skins. It's even possible to make your program look like an application from any other OS, or create your own user WindowBlinds-like or NeoPlanet-like "skinned" interface. # FreeVCL # FreeVCL is a library of almost 20 visual components mostly Office 2k simulation
C#
110,561
社区成员
642,566
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章