Foxtable(狐表)用户栏目专家坐堂 → 目录树清除父结点的问题


  共有2513人关注过本帖树形打印复制链接

主题:目录树清除父结点的问题

帅哥哟,离线,有人找我吗?
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2016/7/18 8:39:00 [显示全部帖子]

 可以看看这个例子:
http://www.foxtable.com/webhelp/scr/2405.htm

其中有段代码就是您要的了:
Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView2")
Dim nd1 As WinForm.TreeNode = trv1.SelectedNode
Dim dr As DataRow
If e.Node.ParentNode IsNot Nothing Then '取消父节点的选中标记,因为选中子节点,就不要选中父节点了
    e.Node.ParentNode.Checked = False
End If
For Each cnd As WinForm.TreeNode In e.Node.Nodes '取消子节点的选中标记,因为选中父节点,就不要选中子节点了
    cnd.Checked = False
Next
If nd1.Level = 0 Then
    dr = DataTables("授权").Find("分组 = '" & nd1.Name & "' And 权限 Is Null")
Else
    dr = DataTables("授权").Find("分组 = '" & nd1.ParentNode.Name & "' And 权限 = '" & nd1.Name & "'")
End If
If dr IsNot Nothing Then
    Dim nms As String
    For Each nd2 As WinForm.TreeNode In trv2.AllNodes
        If nd2.Checked  Then
            nms  = nms & "," &  nd2.Name
        End If
    Next
    If nms > "" Then
        dr("用户") = nms.Trim(",")
    Else
        dr("用户") = Nothing
    End If
End If


 回到顶部