473,659 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using TreeView-control ???

Hi,

anyone experience with the TreeView control that is available in the
Microsoft.Web.U I.WebControls component ?

I want to add a few nodes to the TreeView-control but don't know quite how :

// Creating a few nodes
TreeNode node1 = new TreeNode();
node1.Text = "Canada";
TreeNode node2 = new TreeNode();
node2.Text = "Spain";

// Adding to the collection
TreeNodeCollect ion coll = new TreeNodeCollect ion();
coll.Add(node1) ;
coll.Add(node2) ;

// View nodes in the TreeView-control
TreeView vw = new TreeView();
vw.<WHAT METHOD DO I USE NOW IN ORDER TO ADD THE NODES TO
THE VIEW ?? >

Note : I don't want to use the TreeNodeSrc-property which takes data out of
an
XML-file, no I need to add the data programatically

Thanks
Chris


Nov 18 '05 #1
2 1781
Hi Chirs:

In your code vw.Nodes would be the top level tree node collection to
add to.

vw.Nodes.Add(no de1);

Note you'll also need to get your TreeView onto the web form. The
easiest way is to add it to the ASPX file in a runat="server" tag.

I have an of working programatically with a TreeView, although the
main thrust of the article is Reporting Services integration:

http://odetocode.com/Articles/95.aspx

--
Scott

On Sat, 10 Jul 2004 13:58:44 GMT, "Chris" <ch********@pan dora.be>
wrote:
Hi,

anyone experience with the TreeView control that is available in the
Microsoft.Web. UI.WebControls component ?

I want to add a few nodes to the TreeView-control but don't know quite how :

// Creating a few nodes
TreeNode node1 = new TreeNode();
node1.Text = "Canada";
TreeNode node2 = new TreeNode();
node2.Text = "Spain";

// Adding to the collection
TreeNodeCollect ion coll = new TreeNodeCollect ion();
coll.Add(node1) ;
coll.Add(node2) ;

// View nodes in the TreeView-control
TreeView vw = new TreeView();
vw.<WHAT METHOD DO I USE NOW IN ORDER TO ADD THE NODES TO
THE VIEW ?? >

Note : I don't want to use the TreeNodeSrc-property which takes data out of
an
XML-file, no I need to add the data programatically

Thanks
Chris


--
Scott
http://www.OdeToCode.com
Nov 18 '05 #2
thanks Scott !

Chris

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:2f******** *************** *********@4ax.c om...
Hi Chirs:

In your code vw.Nodes would be the top level tree node collection to
add to.

vw.Nodes.Add(no de1);

Note you'll also need to get your TreeView onto the web form. The
easiest way is to add it to the ASPX file in a runat="server" tag.

I have an of working programatically with a TreeView, although the
main thrust of the article is Reporting Services integration:

http://odetocode.com/Articles/95.aspx

--
Scott

On Sat, 10 Jul 2004 13:58:44 GMT, "Chris" <ch********@pan dora.be>
wrote:
Hi,

anyone experience with the TreeView control that is available in the
Microsoft.Web. UI.WebControls component ?

I want to add a few nodes to the TreeView-control but don't know quite how :
// Creating a few nodes
TreeNode node1 = new TreeNode();
node1.Text = "Canada";
TreeNode node2 = new TreeNode();
node2.Text = "Spain";

// Adding to the collection
TreeNodeCollect ion coll = new TreeNodeCollect ion();
coll.Add(node1) ;
coll.Add(node2) ;

// View nodes in the TreeView-control
TreeView vw = new TreeView();
vw.<WHAT METHOD DO I USE NOW IN ORDER TO ADD THE NODES TO
THE VIEW ?? >

Note : I don't want to use the TreeNodeSrc-property which takes data out ofan
XML-file, no I need to add the data programatically

Thanks
Chris


--
Scott
http://www.OdeToCode.com

Nov 18 '05 #3

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

Similar topics

2
2421
by: Sonia Igla | last post by:
Hi. I need to perform DBLCLK on TreeView Node. I try the following: private static extern int SendMessage(IntPtr hWnd, uint msg, UInt32 wParam, UInt32 lParam); private const UInt32 WM_LBUTTONDBLCLK = 0x203; pTreeNode.TreeView.SelectedNode = pTreeNode;
6
4922
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. However, either it only add it to the root level or it only add it on level below, doesn't matter what I select. And in some case, I just get an exception.
14
15081
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
3
11220
by: Gerhard | last post by:
I have the following code in an .net 2.0 project: <asp:Panel Runat="server" id="pnlNavigation" CssClass="pnlNavigation" Width="165px"> <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None" CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False"> <LevelStyles> <asp:TreeNodeStyle CssClass="homenav" Font-Underline="False" />
1
21616
by: watsod1 | last post by:
Hello, This is my first post, Hello to all. This also a test post to make sure that I am doing the right thing and following rules etc. I have been searching for a way to make the treeview display multiple lines of text on each treeview node (treenode). After searching for answers and not finding any, I stumbled on the solution in the msdn help files (search for TreeView.DrawNode Event). It has source code that shows how to display...
3
1956
by: Franky | last post by:
Been having a problem using a treeview. Work great the first time the form containing it is entered but not the second time. Took a while to create a small sample that exhibits the problem, but here it is. Seems to have something to do with doing ShowDialog Easy to reproduce this project, simply add two forms.
0
6742
by: celoftis | last post by:
Using VS2005, VB code behind, BACKGROUND I'm trying to set up a page with a TreeView of links on the left hand side of my page - when clicked I want the links to open in the remaining portion of the page. The best and easiest way I've found todo this is with using frames (any suggestions on other ways todo this I'd love to hear about it). PROBLEM
6
11962
by: xla76 | last post by:
I have a simple treeview (treeview1) to which I have added two nodes (nodeA and nodeB) which have n levels of child nodes. What I want is to be able to identify whether the child node I select is under NodeA or NodeB. I can do this by splitting the selectednode.fullpath of the child node but there must be a better way. Can any kind soul can enlighten me?
1
1940
by: doug9149 | last post by:
Hello all. I'm trying to parse data stored in XML format into my Windows application using C#. I'd like specific XML Nodes listed in a TreeView. When the TreeView Nodes are clicked I need corresponding XML data displayed in a different panel in the application using perhaps a DataGridView. Currently I have the TreeView part working. But I think I might be doing it inefficiently. I'm currently just traversing each XML Node through it's...
0
7159
by: Dennis Francek | last post by:
Hello I have populated a treeview from my dataset and by clicking in the treeview i want to get the corresponding table shown in a datagridview. Ive managed this by looking at each DataRow and child rows and added the nodes with a columnname from each datarow. At the same time i have put in a tag at each treenode with a filter string and the current table im looking at as a string to use for later so i can create a datatable and set a filter...
0
8751
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8535
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8629
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4176
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2757
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
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.