Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Controlling TreeView Expand/Collapse

Reply
Thread Tools

Controlling TreeView Expand/Collapse

 
 
Tor Inge Rislaa
Guest
Posts: n/a
 
      02-21-2007
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>




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to access the Page from a TreeNode (treeview 's element) : addinga context menu to a treeview abargaddon ASP .Net Building Controls 0 01-17-2008 11:05 AM
Controlling the font of a treeview node Tor Inge Rislaa ASP .Net 0 04-09-2007 05:42 PM
Controlling the TreeView Tor Inge Rislaa ASP .Net 0 02-04-2007 12:07 PM
ASP.NET 2.0 TreeView - Programatically Selecting A TreeView Node =?Utf-8?B?VHltYm93?= ASP .Net 2 01-10-2006 03:51 AM
TreeView not rendering nodes? Cacheing of a TreeView Per Salmi ASP .Net Web Controls 1 10-15-2003 01:15 PM



Advertisments