The TreeView node is mutually exclusive, Autopostback=false method

Source: Internet
Author: User
Treeview

Problem Description: Frameset in the TreeView, inside the four nodes, want to open one, close the other three nodes.
Start is written in Treeview1_expand, can also be used, you can set AutoPostBack to true, refreshing when it is difficult to look at the Internet to find information
Related topics are as follows:
==================
1. "Do not submit when expanding, change the selection node before submitting"
2. "The TreeView expands a node to automatically retract all other expanded nodes, meaning that there is only one expansion node at a time."
3. "The TreeView unfolds without blinking solution"
4. "The TreeView Symposium"
5. "TreeView JavaScript control Method Research"
==================
There is a JavaScript corner on the top of the writing is good, but try for a long time always error.
So I wrote one for myself.


<script  language= "JavaScript" > 
  function  inittree ()
  { 
    var tree = document.all["TreeView1"];
    tree.attachevent ("Onexpand", selectedindexchange);//Append Events
 }
  function Selectedindexchange ()
  {
    var temp = this. Treeview1.clickednodeindex;
    var nodes = new Array ();
    nodes = this. Treeview1.getchildren ();
    for (i=0;i<nodes.length;i++)
    {
      if (i!=temp)
      {
        if (i<10)
   Nodeindex = "0" +i;//I have only used four nodes, more than 10 of the self try it.
 this. Treeview1.gettreenode (Nodeindex). setattribute (' expanded ', ' false ');
     }
   }
}
</script>
finally write a
<body
in the body to use.

It is also possible to write JavaScript in Page_Load, as in the "TreeView Symposium", but that would be cumbersome and prone to error.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.