) The Treeview node is mutually exclusive. autopostback = false

Source: Internet
Author: User
Problem description: The Treeview in frameset contains four nodes. If you want to open one, close the other three nodes.
It is written in treeview1_expand at the beginning. It can also be used. You can set autopostback to true. It is difficult to refresh, so you can find information on the Internet.
Related topics are as follows:
============================
1. "Do not submit when expanding, submit only when you change the node selection"
2. "enable the Treeview to expand a node and automatically scale back all other expanded nodes, that is, there is only one expanded node at a time"
3. "Treeview unblinking solution"
4. "Treeview topic discussion"
5. "Treeview JavaScript Control Method Research"
============================
There is a javascript corner on it, which is well written. But after trying for a long time, it is always wrong.
So I wrote one 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 only use four nodes, and try more than ten nodes.
This. treeview1.gettreenode (nodeindex). setattribute ('extended', 'false ');
}
}
}
</SCRIPT>
Finally, write
<Body onload = "inittree ();">
You can use it.

Of course, JavaScript can also be written in page_load like in the "Treeview topic discussion", but it is very troublesome,
It is easy to make mistakes.

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.