473,414 Members | 1,948 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,414 software developers and data experts.

Hide Treeview Root Node

Hello,

I have treeview control that I am populating with a XML file. The
structure is:

Treenode
Level 1
Item1
Item2
Item3
Level 2
Item1
Item2
Item3

I do not want Treenode (root node) to show up, only Level and Level 2
and their applicable items. This would not seem that it should be to
difficult, but I can not seem to find an answer to it.

Thanks,
Greg

Jun 28 '06 #1
4 15914
hartbypass wrote:
Hello,

I have treeview control that I am populating with a XML file. The
structure is:

Treenode
Level 1
Item1
Item2
Item3
Level 2
Item1
Item2
Item3

I do not want Treenode (root node) to show up, only Level and Level 2
and their applicable items. This would not seem that it should be to
difficult, but I can not seem to find an answer to it.

Thanks,
Greg

How are you binding your xml to the treeview?

JB
Jun 29 '06 #2
Like this:

<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="XMLSalesDataSource" ExpandDepth="1" ShowLines="True"
EnableTheming="True" EnableViewState="False"
OnSelectedNodeChanged="TreeView1_SelectedNodeChang ed">
<DataBindings>
<asp:TreeNodeBinding DataMember="TREENODES"
TextField="text" />

<asp:TreeNodeBinding DataMember="treenode"
TextField="text" />
<asp:TreeNodeBinding DataMember="treenode1"
NavigateUrlField="NavigateURL" TextField="text"
ImageUrlField="imageURL" />
</DataBindings>
</asp:TreeView>
<asp:XmlDataSource ID="XMLSalesDataSource" runat="server"
DataFile="~/Documents/Sales/Filename.xml">
</asp:XmlDataSource>
TREENODES
treenode
treenode1
treenode1
treenode1
treenode
treenode1
treenode1
treenode1

The treenode1 is a link to a file, like a word doc, I am also having an
issue trying to launch to a target="_blank". I tried using the Target
property of the treeview control, but my guess is that means something
else. I had it working in 1.1 with the treeview there, but had to do a
lot more coding and I am trying to convert everything to 2.0.

Thanks.
John B wrote:
hartbypass wrote:
Hello,

I have treeview control that I am populating with a XML file. The
structure is:

Treenode
Level 1
Item1
Item2
Item3
Level 2
Item1
Item2
Item3

I do not want Treenode (root node) to show up, only Level and Level 2
and their applicable items. This would not seem that it should be to
difficult, but I can not seem to find an answer to it.

Thanks,
Greg

How are you binding your xml to the treeview?

JB


Jun 29 '06 #3
Ignore the bottom part of the response I got the target to work. I
must have been using the wrong value from my xml file or something.

Thanks,
Greg

hartbypass wrote:
Like this:

<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="XMLSalesDataSource" ExpandDepth="1" ShowLines="True"
EnableTheming="True" EnableViewState="False"
OnSelectedNodeChanged="TreeView1_SelectedNodeChang ed">
<DataBindings>
<asp:TreeNodeBinding DataMember="TREENODES"
TextField="text" />

<asp:TreeNodeBinding DataMember="treenode"
TextField="text" />
<asp:TreeNodeBinding DataMember="treenode1"
NavigateUrlField="NavigateURL" TextField="text"
ImageUrlField="imageURL" />
</DataBindings>
</asp:TreeView>
<asp:XmlDataSource ID="XMLSalesDataSource" runat="server"
DataFile="~/Documents/Sales/Filename.xml">
</asp:XmlDataSource>
TREENODES
treenode
treenode1
treenode1
treenode1
treenode
treenode1
treenode1
treenode1

The treenode1 is a link to a file, like a word doc, I am also having an
issue trying to launch to a target="_blank". I tried using the Target
property of the treeview control, but my guess is that means something
else. I had it working in 1.1 with the treeview there, but had to do a
lot more coding and I am trying to convert everything to 2.0.

Thanks.
John B wrote:
hartbypass wrote:
Hello,

I have treeview control that I am populating with a XML file. The
structure is:

Treenode
Level 1
Item1
Item2
Item3
Level 2
Item1
Item2
Item3

I do not want Treenode (root node) to show up, only Level and Level 2
and their applicable items. This would not seem that it should be to
difficult, but I can not seem to find an answer to it.

Thanks,
Greg

How are you binding your xml to the treeview?

JB


Jun 29 '06 #4
hartbypass wrote:
Like this:

<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="XMLSalesDataSource" ExpandDepth="1" ShowLines="True"
EnableTheming="True" EnableViewState="False"
OnSelectedNodeChanged="TreeView1_SelectedNodeChang ed">
<DataBindings>
<asp:TreeNodeBinding DataMember="TREENODES"
TextField="text" />

<asp:TreeNodeBinding DataMember="treenode"
TextField="text" />
<asp:TreeNodeBinding DataMember="treenode1"
NavigateUrlField="NavigateURL" TextField="text"
ImageUrlField="imageURL" />
</DataBindings>
</asp:TreeView>
<asp:XmlDataSource ID="XMLSalesDataSource" runat="server"
DataFile="~/Documents/Sales/Filename.xml">
</asp:XmlDataSource>
TREENODES
treenode
treenode1
treenode1
treenode1
treenode
treenode1
treenode1
treenode1

The treenode1 is a link to a file, like a word doc, I am also having an
issue trying to launch to a target="_blank". I tried using the Target
property of the treeview control, but my guess is that means something
else. I had it working in 1.1 with the treeview there, but had to do a
lot more coding and I am trying to convert everything to 2.0.
<...>
I cant see any other solution other than editing the xml before binding
if you want to hide the root node :(

Sorry

JB
Jul 2 '06 #5

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

Similar topics

8
by: Don Wash | last post by:
Hi There! I'm using VB.NET to create a TreeView application and unfortunately I could not find "Key" property in Node items of the TreeView. We used to have "Key" property in TreeView node...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
9
by: Marina | last post by:
Hello! I have a database with some customers. Each one of them has 3 other customers under him etc. (something like an MLM system). Now, I want to create a treeview with this. Eg. C1 C11...
7
by: amruta | last post by:
the code below dows not let me get the parent child view... all the nodes are show in one line only... also i need them to be collasped ... Thanks ..
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
4
by: Henry | last post by:
Does anybody have a real-world sample of buiding a treeview control using data from database tables? All the sample code I have found either builds the treeview manually or uses a file directory...
0
by: jotaefe | last post by:
Hi, Is it possible to hide the root node in a treeview without editing the original xml? To populate the xml file, I am using this functions: private void PopulateTree(TreeView...
1
by: JRSofty | last post by:
Hi everyone, I've gotten myself is bit of a mess where I'm loading a treeview. Basically I initialize the treeview control with a single root node we'll call it root. I do this by using the...
11
by: pbd22 | last post by:
Hi. I am getting odd treeview results and hope you can help. I am parsing a string, "x/y/z", turning it into an array (that always seems to start with an empty string) and then using the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
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
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...
0
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...

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.