参考一下,可能有帮助
http://www.csdn.net/develop/read_article.asp?id=22100

解决方案 »

  1.   

    我记得好像是直接
    document.all.treeview1.selectedNodeIndex='0.0';
      

  2.   

    function searchnode(){
    var AllRootNode = new Array();
    AllRootNode = document.all("TreeView1").getChildren();
    AlertNode(AllRootNode);

    }function AlertNode(NodeArray){
    if(parseInt(NodeArray.length)==0)
    return;
    else
    {
    for(i=0;i<NodeArray.length;i++){
    var cNode;
    cNode = NodeArray[i];
    if(document.all("iscd").checked){
    if(cNode.getAttribute("ID")==document.all("searchstr").value){
    parent.document.all.rep_view.src = "viewreport.aspx?RepID=" + cNode.getAttribute("ID");
    cNode.Selected = true;//在这里要使这个节点被选中
    alert(cNode.getAttribute("NodeIndex"));
    return;
    }
    }else
    {
    var src = cNode.getAttribute("Text");
    var search = document.all("searchstr").value;
    if(src.indexOf(search)!=-1){
    parent.document.all.rep_view.src = "viewreport.aspx?RepID=" + cNode.getAttribute("ID");
    cNode.Selected = true;//在这里要使这个节点被选中
    return;
    }
    }
    if(parseInt(cNode.getChildren().length)!=0)
    AlertNode(cNode.getChildren());
    }
    }

    }
      

  3.   

    <script>
    function fileSel(){
      document.all("TreeView1").setAttribute("selectedNodeIndex","2.4")
    return true;

    </script>
    注意大小写
      

  4.   

    我只知道结点的ID各他的text不知道他的index怎么选定?
      

  5.   

    首先保证装好你的组件,这个包安装非常方便,只要运行一下即可在VS.NET中使用了:
    http://218.56.11.178:8018/FileDown.aspx?FID=4看看这个例子,对你一定有启发:
    http://218.56.11.178:8018/FileDown.aspx?FID=246这个论坛也使用了树:
    http://218.56.11.178:8018/FileDown.aspx?FID=212论坛的使用演示地址,在这里:
    http://expert.kaer.cn/提供站点:http://soft.kaer.cn       希望大家多支持!
    ftp://soft.kaer.cn   可以直接用IE匿名访问,目前速度没限制。