获取UltraWebTree指定节点的所有父节点内容

(继续资源库小程序中UltraWebTree的使用方法,上一篇是利用数据库来填充UltraWebTree
功能要求:当我点击UltraWebTree中子节点时,需要获取该节点所有父节点内容,这样我就能获得该子节点下文件的目录路径了
外加功能:点击节点,其下所有文件显示在UltraWebGrid列表中,其所有目录路径也保存在一个列表中
表结构在文章利用数据库来填充UltraWebTree 中说明了。
UltraWebTree节点点击事件代码:

 1 private   void  UltraWebTree1_NodeClicked( object  sender, Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
 2    {
 3   DataTable dnodechild = Query.ProcessSql("SELECT fname FROM files where fcid='"+ int.Parse(e.Node.DataKey.ToString()) + "'",GlobalVar.DBName); 
 4      DataColumn roothide = new DataColumn("RootText");
 5   //
 6   string nodetext="";
 7   Infragistics.WebUI.UltraWebNavigator.Node node = e.Node; 
 8   do
 9   {
10    nodetext =  node.Text +"//"+ nodetext;
11    node = node.Parent; 
12   }

13   while (node != null);
14   roothide.DefaultValue = nodetext;
15   //
16   dnodechild.Columns.Add(roothide);
17   this.UltraWebGrid1.Dispose();
18   this.UltraWebGrid1.DataSource = dnodechild;
19   this.UltraWebGrid1.DataBind();
20   dnodechild.Dispose();
21  }

Query.ProcessSql 是用了听棠的SPL持久层,GlobalVar.DBName是数据名
用到了Infragistics另一个UltraWebGrid控件,UltraWebGrid控件中有2列,分别是RootText,fname。

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值