inittree(TreeView1.Nodes, 0)
End If
End Sub
Private Sub inittree(ByVal nds As TreeNodeCollection, ByVal parentid As Integer)
Dim sql As String = "select * from catalogs"
Dim dt As DataSet = DBcon.SelectCMD(sql)
Dim catarows As DataRow() = dt.Tables(0).Select("parentid=" & parentid)
For Each row As DataRow In catarows
Dim tmpnd As New TreeNode()
tmpnd.Value = row("catalogid")
tmpnd.Text = row("catalogname")
nds.Add(tmpnd)
inittree(tmpnd.ChildNodes, tmpnd.Value)
Next
End Sub
Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.SelectedNodeChanged
Dim typeid As Integer = Me.TreeView1.SelectedNode.Value
Response.Redirect("listzl.aspx?typeid=" & typeid)
End Sub
4.4 页面(listzl.aspx)
Partial Class listzl
Dim strsql As String
Dim table1 As DataTable
Dim dttable As DataTable
Dim dttypename As DataTable
|