Simple question on Treeview?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

Thanks for reviewing my question. I would like to know how can I programmatically select a node

Thanks in Advanc
Peter
 
Peter,

If it is the TreeView Control; try this
Gets or sets a TreeNode object that represents the selected node in the
TreeView control. Please start here"
http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.web.ui.webcontrols/c/
treeview/p/selectednode.aspx

<%@ Page Language="C#" %>

<script runat="server">

void SpacingIndex_Changed(Object sender, EventArgs e)
{

// Set the vertical spacing of the selected node based on the value
selected by the user.
LinksTreeView.SelectedNodeStyle.VerticalPadding =
Convert.ToInt32(SpacingList.SelectedItem.Text);

}

void ColorIndex_Changed(Object sender, EventArgs e)
{

// Set the foreground (font) color of the selected node based on
the value selected by the user.
LinksTreeView.SelectedNodeStyle.ForeColor =
System.Drawing.Color.FromName(ColorList.SelectedItem.Text);

}

void Select_Change(Object sender, EventArgs e)
{

Message.Text = "You selected: " + LinksTreeView.SelectedNode.Text;

}

--------------------
Thread-Topic: Simple question on Treeview?
thread-index: AcQCF4+B4d7YB7S9Tay6VlBKJ7Y7hQ==
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
From: "=?Utf-8?B?UGV0ZXI=?=" <[email protected]>
Subject: Simple question on Treeview?
Date: Thu, 4 Mar 2004 10:36:08 -0800
Lines: 6
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.languages.csharp
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:226424
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Hello,

Thanks for reviewing my question. I would like to know how can I
programmatically select a node?

Thanks in Advance
Peter
Cheers,

johnKn [MS-SDK]



-Please do not send email directly to this alias. This alias is for
newsgroup purposes only


-This posting is provided “AS IS” with no warranties, and confers no rights.



-To provide additional feedback about your community experience please send
e-mail to: (e-mail address removed)
 
John

First, I am using a Treeview in a form. Next, I you might misunderstood my question. I want to select a specific node not find out which node is selected. I know I can find the selected node by the property .SelectedNode. Any clues

Many Thank
Peter
 
First, I am using a Treeview in a form. Next, I you might misunderstood
my question. I want to select a specific node not find out which node is
selected. I know I can find the selected node by the property
..SelectedNode. Any clues?

Why not simply set SelectedNode to point to the node you want? I could be
wrong, but I think that's all you have to do.

Remember, each of the nodes is really a pointer... so is SelectedNode.
 
Back
Top