468,780 Members | 2,324 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,780 developers. It's quick & easy.

Controlling TreeView Expand/Collapse

Controlling TreeView Expand/Collapse

With a TreeView bound to an XML file as below I want to obtain the
functionality where Chapter 2 and 3 are forced to collapse when Chapter 1 is
selected and Chapter 1 and 3 collapses when Chapter 2 is selected and so on.

Any Ideas on how to solve this in a smart way?

Data bindings

<asp:TreeView id="BookTreeView"

DataSourceID="BookXmlDataSource"

runat="server">

<DataBindings>

<asp:TreeNodeBinding DataMember="Book" TextField="Title"/>

<asp:TreeNodeBinding DataMember="Chapter" TextField="Heading"/>

<asp:TreeNodeBinding DataMember="Section" TextField="Heading"/>

</DataBindings>

</asp:TreeView>

<asp:XmlDataSource id="BookXmlDataSource"

DataFile="Book.xml"

runat="server">

</asp:XmlDataSource>

The XML file

<Book Title="Book Title">

<Chapter Heading="Chapter 1">

<Section Heading="Section 1"/>

<Section Heading="Section 2"/>

<Section Heading="Section 3"/>

</Chapter>

<Chapter Heading="Chapter 2">

<Section Heading="Section 1"/>

<Section Heading="Section 2"/>

<Section Heading="Section 3"/>

</Chapter>

<Chapter Heading="Chapter 3">

<Section Heading="Section 1"/>

<Section Heading="Section 2"/>

<Section Heading="Section 3"/>

</Chapter>

</Book>


Feb 21 '07 #1
0 2125

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Gönen EREN | last post: by
2 posts views Thread by Stephen | last post: by
1 post views Thread by christoffer.lantz | last post: by
3 posts views Thread by Shawn | last post: by
reply views Thread by Tor Inge Rislaa | last post: by
reply views Thread by Tor Inge Rislaa | last post: by
1 post views Thread by =?Utf-8?B?U3dvb3No?= | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.