microsoft webcontrols控件包括四个组件:MultiPage、TabStrip、Toolbar、treeView,treeview可以到http://msdn.microsoft.com/downloads/samples/internet/ASP_DOT_NET_ServerControls/WebControls/default.asp去下载,下载后得到文件IEWebControls,只有360KB,安装后自动在C:\Program Files建立IE Web Controls,执行其下面的bulid.bat,如果安装后还不能使用可以采用以下方法解决:
Imports System.Data
Imports System.Data.SqlClient
Public Class tree1
Inherits System.Web.UI.Page
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strconnection As String = "server=zln\netsdk;uid=sa;pwd=sa;database=english"
Dim conn As New SqlConnection(strconnection)
conn.Open()
Dim sql As String = "select * from zlk where kemu='" & Session("node").ToString & "'"
Dim cmd As New SqlCommand(sql, conn)
Dim da As SqlDataReader
da = cmd.ExecuteReader
DataGrid1.DataSource = da
DataGrid1.DataBind()
End Sub
Private Sub TreeView1_SelectedIndexChange(ByVal sender As Object, ByVal e As Microsoft.Web.UI.WebControls.TreeViewSelectEventArgs) Handles TreeView1.SelectedIndexChange
Dim ndsel As New Microsoft.Web.UI.WebControls.TreeNode()
ndsel = TreeView1.GetNodeFromIndex(TreeView1.SelectedNodeIndex)
Session("node") = ndsel.Text
End Sub