473,563 Members | 2,856 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="BookTreeVie w"

DataSourceID="B ookXmlDataSourc e"

runat="server">

<DataBindings >

<asp:TreeNodeBi nding DataMember="Boo k" TextField="Titl e"/>

<asp:TreeNodeBi nding DataMember="Cha pter" TextField="Head ing"/>

<asp:TreeNodeBi nding DataMember="Sec tion" TextField="Head ing"/>

</DataBindings>

</asp:TreeView>

<asp:XmlDataSou rce id="BookXmlData Source"

DataFile="Book. xml"

runat="server">

</asp:XmlDataSour ce>

The XML file

<Book Title="Book Title">

<Chapter Heading="Chapte r 1">

<Section Heading="Sectio n 1"/>

<Section Heading="Sectio n 2"/>

<Section Heading="Sectio n 3"/>

</Chapter>

<Chapter Heading="Chapte r 2">

<Section Heading="Sectio n 1"/>

<Section Heading="Sectio n 2"/>

<Section Heading="Sectio n 3"/>

</Chapter>

<Chapter Heading="Chapte r 3">

<Section Heading="Sectio n 1"/>

<Section Heading="Sectio n 2"/>

<Section Heading="Sectio n 3"/>

</Chapter>

</Book>


Feb 21 '07 #1
0 2331

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

Similar topics

4
3395
by: Gönen EREN | last post by:
how can i collapse or expand a node of treeview control programmaticly? thanks.
2
2415
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 treeview control in .net 2.0. Anyone know of way to expand a node when a users clicks the node text?
1
1810
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 subtree to be open at a time. Can the treeview control do this by itself or is some fiddeling required? Regards, Lantz
0
2549
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 hyperlinks generated for the expand/collapse buttons includes javascript code that will execute in the frame specified in the Base Target rather...
3
2243
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 child node or a leaf node then a DataGrid is populated based on the node's ID property. If I expand a node then the DataGrid is not populated. This...
0
2409
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 property set to the Web.sitemap file. I have turned off the Expand/Collapse icons on the Treeview. I want to be able to single click a node in...
0
1111
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 of Products (Product1 and Product1) should reveal when the user click on the title Products. <?xml version="1.0" encoding="utf-8" ?> <siteMap>
0
5253
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 set on the TreeView control?) My control I bound to a web.sitemap as below: <?xml version="1.0" encoding="utf-8" ?> <siteMap> <siteMapNode...
1
2679
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 way I should do it, or should i add some event somehow to each node
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6255
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.