这是“加载”按钮的代码
Dim trv As WinForm.TreeView = e.Form.Controls("信访拟办目录树")
Dim qsj As WinForm.DateTimePicker = e.Form.Controls("起时间加载")
Dim zsj As WinForm.DateTimePicker = e.Form.Controls("止时间加载")
Dim djsj As WinForm.ComboBox = e.Form.Controls("登记时间加载")
Dim tj As String = "登记时间 >= #" & qsj.Value & "# And 登记时间 <= #" & zsj.Value & "# "
'================目录树==============
'建立目录树
trv.StopRedraw '停止绘制目录树
Dim dt As DataTable = DataTables("信访拟办_拟办表")
dt.LoadFilter = ""
dt.LoadFilter = tj
dt.Load()
trv.BuildTree(dt,"归属地|初信访登记编号|信访编号")
trv.Nodes.Insert("加载全部数据",0)
trv.Nodes(0).ForeColor = Color.Red
For Each nd1 As WinForm.TreeNode In trv.AllNodes
If nd1.Level = 0 Then
nd1.MoveRight
End If
Next
For Each nd As WinForm.TreeNode In trv.AllNodes '遍历所有节点
If nd.Level = 0 Then '如果是三级节点
nd.Text =nd.text & "(共" & DataTables("信访拟办_拟办表").DataRows.Count & "条数据)"
nd.Ic
End If
If nd.Level = 1 Then '如果是三级节点
nd.Text =nd.text & "(" & nd.Nodes.Count & "件)"
nd.Ic
End If
If nd.Level = 2 Then '如果是二级节点
nd.Text = "【" & nd.DataRow("姓名") & "】信访件" & "(共" & nd.Nodes.Count & "次)"
nd.Ic
End If
If nd.Level = 3 Then '如果是三级节点
nd.Text =nd.DataRow("信访编号") & "(" & nd.DataRow("初重信访") & ")"
nd.Ic
End If
Next
trv.ResumeRedraw '恢复绘制目录树
trv.SelectedNode = trv.Nodes(0)
With DataTables("信访拟办_拟办表")
.LoadFilter = "" '清除加载条件
.LoadFilter = tj
.LoadOrder = "拟办状态"
.LoadPage = 0 '加载第一页
.LoadTop = 10 '每页10行
.Load()
e.Form.Controls("页数").Value = 1 & "/" & .TotalPages
End With
问题出在:目录树只根据表中第一页数据生成,我想实现,目录树根据指定加载条件表中所有数据生成。