TreeNode.NavigateUrl Property

Gets or sets the URL to navigate to when the node is clicked.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public string NavigateUrl { get; set; }
/** @property */
public String get_NavigateUrl ()

/** @property */
public void set_NavigateUrl (String value)

public function get NavigateUrl () : String

public function set NavigateUrl (value : String)

Not applicable.

Property Value

The URL to navigate to when the node is clicked. The default value is an empty string (""), which indicates that this property is not set.

The text of a node can be in one of two modes: selection mode or navigation mode. By default, a node is in selection mode. To put a node into navigation mode, set the node's NavigateUrl property to a value other than an empty string.

When a node is in navigation mode, all selection events are disabled for that node. Clicking the node in navigation mode links the user to the specified URL. You can optionally set the Target property to specify the window or frame in which to display the linked content.

The value of this property is stored in view state.

The following code example demonstrates how to set up the frames for the next code example.

<html xmlns="">
    <title>TreeView Frameset Example</title>
    <frameset cols="30%, 75%">
        <frame title="MenuFrame" name="Menu" src="TreeViewFramecs.aspx"/>
        <frame title="ContentFrame" name="Content" src="Home.aspx"/> 

The following code example demonstrates how to use the NavigateUrl property to specify the URL to link to when the node is clicked. This example is used within the frameset of the previous example to display a table of contents.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" >
  <head runat="server">
    <title>TreeView Declarative Syntax Example</title>
    <form id="form1" runat="server">
      <h3>TreeView Declarative Syntax Example</h3>
      <asp:TreeView id="SampleTreeView" 
          <asp:TreeNode Value="Home" 
            <asp:TreeNode Value="Page 1" 
              <asp:TreeNode Value="Section 1" 
                Text="Section 1"
            <asp:TreeNode Value="Page 2" 
              Text="Page 2"


Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions