Export (0) Print
Expand All

SiteMapDataSource.StartingNodeUrl Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a node in the site map that the data source then uses as a reference point to retrieve nodes from a hierarchical site map.

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

public virtual string StartingNodeUrl { get; set; }
/** @property */
public String get_StartingNodeUrl ()

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

public function get StartingNodeUrl () : String

public function set StartingNodeUrl (value : String)

Property Value

The URL of a node in the site map. The SiteMapDataSource retrieves the identified SiteMapNode and any child nodes from the site map. The default is an Empty.

The SiteMapDataSource property binds to site map data and presents its view based on a specified starting node in the site map hierarchy. By default, the starting node is the root node of the hierarchy, but you can set the starting node to any node with the StartingNodeUrl property or set the StartFromCurrentNode property to true.

The value of the StartingNodeUrl property is stored in view state.

The following code example demonstrates how to declaratively set the StartingNodeUrl property and bind a TreeView control to a SiteMapDataSource control.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<HTML>
    <BODY>
        <FORM runat="server">
            <asp:SiteMapDataSource
                id="SiteMapDataSource1"
                runat="server"
                StartingNodeUrl="WebForm1.aspx">
            </asp:SiteMapDataSource>

            <asp:TreeView
                id="TreeView1"
                runat="server"
                DataSourceID="SiteMapDataSource1">
            </asp:TreeView>

        </FORM>
    </BODY>
</HTML>

<%@ Page Language="VJ#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<HTML>
    <BODY>
        <FORM runat="server">
            <asp:SiteMapDataSource
                id="SiteMapDataSource1"
                runat="server"
                StartingNodeUrl="WebForm1.aspx">
            </asp:SiteMapDataSource>

            <asp:TreeView
                id="TreeView1"
                runat="server"
                DataSourceID="SiteMapDataSource1">
            </asp:TreeView>

        </FORM>
    </BODY>
</HTML>

<siteMap>
  <siteMapNode title="Home" url="~/Home.aspx" >
    <siteMapNode title="Warehouses" 
      url="~/warehouse/warehouses.aspx" />
    <siteMapNode title="Inventory Levels" 
      url="~/inventory/inventory.aspx" />
    <siteMapNode title="Administration"  >
      <siteMapNode title="Create New User" 
        url="~/usermanagement/createnewuser.aspx"/>
      <siteMapNode title="Manage Roles" 
        url="~/usermanagement/roles.aspx"/>
      <siteMapNode title="Manage User-to-Role Assignments" 
        url="~/usermanagement/manageuserroles.aspx"/>
      </siteMapNode>
    <siteMapNode title="Help" url="~/help.aspx" />	
    <siteMapNode title="Home" url="~/Home.aspx?" />	 
  </siteMapNode>
</siteMap>

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft