Επεξεργασία

Κοινή χρήση μέσω


SiteMapDataSource.StartingNodeUrl Property

Definition

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.

public:
 virtual property System::String ^ StartingNodeUrl { System::String ^ get(); void set(System::String ^ value); };
public virtual string StartingNodeUrl { get; set; }
member this.StartingNodeUrl : string with get, set
Public Overridable Property StartingNodeUrl As 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.

Examples

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 xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" 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="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" 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>

Remarks

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.

Applies to

See also