在webform中如何设置TreeView的节点!

解决方案 »

  1.   

    问题2:在webForm中,如何编写TreeView的双击事件的!
      

  2.   

    TreeNode tn= new TreeNode();
    tn.Text="string";
    treeview1.Nodes.Add(tn);
    只显示string,不显示链接
      

  3.   

    控件有问题,是安装问题吧。
    看看wwwroot中有没有C:\Inetpub\wwwroot\webctrl_client\1_0这个目录。
      

  4.   

    TreeView有自己的双击事件,只要在事件中测试是否选中某个节点就行了
      

  5.   

    1.  Copy the contents of the Runtime directory to the webctrl_client\1_0
        directory under your top-level site directory.  For example, if your 
        site root is c:\Inetpub\wwwroot, type this at the command prompt:    xcopy /s /i .\build\Runtime c:\Inetpub\wwwroot\webctrl_client\1_0 /y    This will create the following directory structure under the site:      /webctrl_client/1_0
            MultiPage.htc
            TabStrip.htc
            toolbar.htc
            treeview.htc
            webservice.htc
            webserviced.htc
            [images]      *
            [treeimages]  *
    带星的看到了吗?那就是图的文件夹,你不按他说的建文件夹,他是找不到的,就显
    不出来了:)
      

  6.   

    添加这个文件。webctrl_client\1_0这个目录。
      

  7.   

    private System.Boolean CreateTree(System.Windows.Forms.TreeNodeCollection CurNodes,int ParentID)
    {
    System.Data.DataView dvNode=new System.Data.DataView();
    TreeNode tmpNode;
    dvNode.Table=dsNode.Tables["目录"];
    dvNode.RowFilter="ParentID="+ParentID;
    foreach (System.Data.DataRowView drv in dvNode)
    {  
    tmpNode=new TreeNode();
    tmpNode.Tag=(object) drv["NodeID"];
    tmpNode.Text=drv["NodeText"].ToString() ;
    CurNodes.Add(tmpNode);
    CreateTree(tmpNode.Nodes,System.Int16.Parse(tmpNode.Tag.ToString())); 
    }
    return true;
    }
    //我的一个生成目录树的函数!用Tag存储目录号!
      

  8.   

    不能正常显示的话重装一下iewebcontrols组件