System.Web.UI.WebControls Namespace TreeNode Class
.NET Framework version 2.0
Sets or retrieves the destination of the TreeNode control.
Inline |
<asp:treenode navigateurl = strUrl ... > |
Script |
TreeNode.NavigateUrl [ = strUrl ] |
strUrl |
String specifying the URL to link to when the treenode is clicked. |
The property is read/write with no default value.
Use the NavigateUrl property to specify or determine the URL to navigate to when the TreeNode control is clicked.
A node can be in one of two modes: selection mode or navigation mode. A node is in navigation mode when the NavigateUrl property for the node is set to a value other than an empty string. Otherwise, the node is in selection mode, wherein the user can select a node by clicking on the node text.
When a node is in navigation mode, all selection events are disabled for that node. Clicking the node in navigation mode takes the user to the specified URL.
By default, the linked content is opened in the current window or frame, or in the window or frame specified by the TreeView control's Target ptoperty. You can, however, optionally set the individual node's Target property to specify the window or frame in which to display the linked content.
The following example demonstrates how to programmatically set the NavigateUrl property to specify the URL to navigate to when the user clicks a TreeNode.
TreeNode newNode = new TreeNode ( row [ "catalog" ].ToString ( ), row [ "tops" ].ToString ( ) );
newNode.NavigateUrl = string.Format ( "~/shop/catalogs.aspx?mode={0}", row [ "mode" ] );
myTreeView.Nodes.Add ( newNode );
Dim newNode As New TreeNode ( row ( "catalog" ).ToString ( ), row ( "tops" ).ToString ( ) )
newNode.NavigateUrl = String.Format ( "~/shop/catalogs.aspx?mode={0}", row ( "mode" ) )
myTreeView.Nodes.Add ( newNode ) |
|
C# |
VB |
Show me
TreeNode Members