473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 2319

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gönen EREN | last post by:
how can i collapse or expand a node of treeview control programmaticly? thanks.
2
by: Stephen | last post by:
In asp.net 1.1, the IE treeview web control has a property called "SelectExpands" that, when set to true, expands a node when a user clicks the node text. I can't seem to replicate this in the...
1
by: christoffer.lantz | last post by:
Howdy folks. Would anyone care to suggest a way to have sibling nodes (at the same level) collapse when a node is expanded in an asp.net 2.0 treeview control? What I mean is that I want only one...
0
by: Shadow Lynx | last post by:
When using ASP.NET 2.0's built-in TreeView on a page with <BASE target = "AnythingBut_Self"></BASE> in the HEAD, the expand/collapse buttons fail to function. The reason for this is that the...
3
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
0
by: jim | last post by:
Hi, I have a TreeView control that sits on the MasterPage. All of my other webpages inherit from that Master Page. The Treeview receives it's data using an XMLDataSource that has it's DataFile...
0
by: Tor Inge Rislaa | last post by:
Controlling the TreeView I have the sitemap below as source for my TreeView control. When I open my application I want only the nodes Home, About, Products and Contact to show. The child nodes...
0
by: Tor Inge Rislaa | last post by:
I need to expand/collapse TreeView nodes to show/hide childnodes by clikcing on the node text (instead of using the expand/collapse icon). Does anyone know how to do that? (What property has to be...
1
by: =?Utf-8?B?U3dvb3No?= | last post by:
i have a treeview (id="trv") i would like to do something like this: trv.Attributes.Add("onexpand", "javascript:alert(this);"); i cannot make this work i would like to know if this is the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.