http://expert.csdn.net/Expert/topic/1525/1525202.xml
http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=49682

解决方案 »

  1.   

    Create three .aspx filesTreeViewDataSet.aspx<%@ import Namespace="Microsoft.Web.UI.WebControls" %>
    <%@ Register TagPrefix="IE" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %><html>
    <head>
    <title>
    TreeViewDataSet.aspx
    </title>
    </head>
    <body>
    <form runat="Server">
    <IE:TreeView
     AutoPostBack="True"
     TreeNodeSrc="Categories.aspx"
     Runat="Server"/>
    </form>
    </body>
    </html>Categories.aspx
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %><Script runat="Server">
    sub page_load
     Dim mycon as SqlConnection
     Dim cmdCategories As SqlCommand
     Dim dsCategories As DataSet
     Dim strQuery As String mycon=New Sqlconnection("Server=localhost;UID=sa;PWD=secret;Database=Northwind")
     strQuery="select categoryname as Text,'products.aspx?catid='
     +LTRIM(STR(CategoryID))" & _
     "As TreeNodeSrc from Categories As TreeNode for xml auto, XMLDATA"
     cmdCategories=new SqlCommand(strQuery,mycon)
     dsCategories=New DataSet
     dsCategories.ReadXML(cmdCategories.ExecuteXmlReader(),XmlReadMode.Fragment)
     dsCategories.DataSetName="TREENODES"
     dsCategories.WriteXml(Response.OutputStream)
    end sub
    </script>Products.aspx
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %><Script runat="Server">
    sub page_load
     Dim mycon as SqlConnection
     Dim cmdProducts As SqlCommand
     Dim dsProducts As DataSet
     Dim strQuery As String mycon=New Sqlconnection("Server=localhost;UID=sa;PWD=secret;Database=Northwind")
     strQuery="select Productname as Text from products As TreeNode" & _
     " where CategoryID=@categoryID for xml auto, XMLDATA "
     cmdproducts=new SqlCommand(strQuery,mycon)
     cmdproducts.Parameters.Add(New SqlParameter("@categoryID",Request.QueryString("catID")))
     mycon.open()
     dsproducts=New DataSet
     dsproducts.ReadXML(cmdproducts.ExecuteXmlReader(),XmlReadMode.Fragment)
     dsproducts.DataSetName="TREENODES"
     dsproducts.WriteXml(Response.OutputStream)
     mycon.close()
    end sub
    </script>
      

  2.   


    //&sup3;&otilde;&Ecirc;&frac14;&raquo;&macr;TreeView&Ecirc;&yacute;&frac34;&Yacute;
            private void InitTV(int intVOrderLen)
            {
                SqlDataReader dr;
                SqlCommand myCommand;
                string strSel = "select * from bas_enterprise where
    len(vieworder)="+intVOrderLen+" order by vieworder";
                myCommand = new SqlCommand (strSel, myConnection);
                dr=myCommand.ExecuteReader();
                while (dr.Read ())
                {
                    TreeNode pNode=new TreeNode ();
                    pNode.Text =dr["EntpName"].ToString ();
                    pNode.ID =dr["ViewOrder"].ToString ();
                    TreeView1.Nodes .Add (pNode);            }
                dr.Close ();        }
            private void TreeView1_SelectedIndexChange(object sender,
    Microsoft.Web.UI.WebControls.TreeViewSelectEventArgs e)
            {
                TreeNode NewNode=TreeView1.GetNodeFromIndex
    (TreeView1.SelectedNodeIndex);
                string strNodeId=NewNode.ID .ToString ();
                SqlDataReader dr;
                SqlCommand myCommand;
                int intVOrderLen=strNodeId.Length+2;
                string strSel = "select * from bas_enterprise where
    len(vieworder)="+intVOrderLen+" and vieworder like '%"+strNodeId+"__%'
    order by vieworder";
                myCommand = new SqlCommand (strSel, myConnection);
                dr=myCommand.ExecuteReader();
                NewNode.Nodes .Clear();
                while (dr.Read ())
                {
                    TreeNode pNode=new TreeNode ();
                    pNode.Text =dr["EntpName"].ToString ();
                    pNode.ID =dr["ViewOrder"].ToString ();
                    NewNode.Nodes.Add (pNode);
                }
                dr.Close ();
                TreeView1.ExpandLevel=1;
            }
      

  3.   

    看看:
    www.hrday.com/oauser:zsj
    password:zsjuser:kk
    password:0
      

  4.   

    http://www.csdn.net/develop/read_article.asp?id=23258
      

  5.   

    http://aspxcn.com/dotnetbbs/View.aspx?fbId=17&Id=85954