SiteMapPath 類別

定義

顯示一組文字或影像超連結,讓使用者可以更輕鬆地巡覽網站,而且需要最少的分頁空間數。

public ref class SiteMapPath : System::Web::UI::WebControls::CompositeControl
public class SiteMapPath : System.Web.UI.WebControls.CompositeControl
type SiteMapPath = class
    inherit CompositeControl
Public Class SiteMapPath
Inherits CompositeControl
繼承

範例

下列程式碼範例會在 Web Form 頁面中以宣告方式使用 SiteMapPath 控制項。 此範例示範一些優先順序規則,這些規則會控管範本和樣式套用至 SiteMapPath 節點的順序。

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

<script runat="server">
</script>

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

            <!-- The following example demonstrates some of the orders
                 of precedence when applying styles and templates to
                 functional nodes of a SiteMapPath.

                 The NodeStyle and RootNodeStyle define the same attributes,
                 but are different and conflict with each other: the
                 RootNodeStyle supersedes NodeStyle, and is the style
                 rendered. Notice, however, that the underline style
                 defined by NodeStyle is still applied.

                 Both a CurrentNodeStyle and a CurrentNodeTemplate are
                 defined. A template supersedes a style for a node
                 type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
                 is ignored. -->

            <asp:SiteMapPath ID="SiteMapPath1" runat="server"
                RenderCurrentNodeAsLink="true"
                NodeStyle-Font-Names="Franklin Gothic Medium"
                NodeStyle-Font-Underline="true"
                NodeStyle-Font-Bold="true"
                RootNodeStyle-Font-Names="Symbol"
                RootNodeStyle-Font-Bold="false"
                CurrentNodeStyle-Font-Names="Verdana"
                CurrentNodeStyle-Font-Size="10pt"
                CurrentNodeStyle-Font-Bold="true"
                CurrentNodeStyle-ForeColor="red"
                CurrentNodeStyle-Font-Underline="false">
                <CURRENTNODETEMPLATE>
                        <asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>
                </CURRENTNODETEMPLATE>
            </asp:SiteMapPath>


        </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">

<script runat="server">
</script>

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

            <!-- The following example demonstrates some of the orders
                 of precedence when applying styles and templates to
                 functional nodes of a SiteMapPath.

                 The NodeStyle and RootNodeStyle define the same attributes,
                 but are different and conflict with each other: the
                 RootNodeStyle supersedes NodeStyle, and is the style
                 rendered. Notice, however, that the underline style
                 defined by NodeStyle is still applied.

                 Both a CurrentNodeStyle and a CurrentNodeTemplate are
                 defined. A template supersedes a style for a node
                 type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
                 is ignored. -->

            <asp:SiteMapPath ID="SiteMapPath1" runat="server"
                RenderCurrentNodeAsLink="true"
                NodeStyle-Font-Names="Franklin Gothic Medium"
                NodeStyle-Font-Underline="true"
                NodeStyle-Font-Bold="true"
                RootNodeStyle-Font-Names="Symbol"
                RootNodeStyle-Font-Bold="false"
                CurrentNodeStyle-Font-Names="Verdana"
                CurrentNodeStyle-Font-Size="10pt"
                CurrentNodeStyle-Font-Bold="true"
                CurrentNodeStyle-ForeColor="red"
                CurrentNodeStyle-Font-Underline="false">
                <CURRENTNODETEMPLATE>
                        <asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>
                </CURRENTNODETEMPLATE>
            </asp:SiteMapPath>


        </form>
    </body>
</html>

上一個範例使用預設的網站地圖提供者和具有下列結構的 Web.sitemap 檔案。

<siteMap>
  <siteMapNode title="WebForm1" description="WebForm1" url="WebForm1.aspx" >
    <siteMapNode title="WebForm2" description="WebForm2" url="WebForm2.aspx"/>
  </siteMapNode>
</siteMap>

下列程式碼範例示範如何擴充 控制項, SiteMapPath 並藉由覆 InitializeItem 寫 方法,將新功能新增至控制項。 控制項會在 DropDownSiteMapPath 目前節點之後新增 DropDownList ,以便輕鬆巡覽至目前頁面子節點的頁面。 這個範例示範如何使用 SiteMapNodeItem 物件,包括檢查物件 SiteMapNodeItemType ,並在建立專案之後呼叫 OnItemCreated 方法。

using System;
using System.Collections;
using System.ComponentModel;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

// The DropDownNavigationPath is a class that extends the SiteMapPath
// control and renders a DropDownList after the CurrentNode. The
// DropDownList displays a list of pages found further down the site map
// hierarchy from the current one. Selecting an item in the DropDownList
// redirects to that page.
//
// For simplicity, the DropDownNavigationPath assumes the
// RootToCurrent PathDirection, and does not apply styles
// or templates the current node.
//
[AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)]
public class DropDownNavigationPath : SiteMapPath {
    // Override the InitializeItem method to add a PathSeparator
    // and DropDownList to the current node.
    protected override void InitializeItem(SiteMapNodeItem item) {

        // The only node that must be handled is the CurrentNode.
        if (item.ItemType == SiteMapNodeItemType.Current)
        {
            HyperLink hLink = new HyperLink();

            // No Theming for the HyperLink.
            hLink.EnableTheming = false;
            // Enable the link of the SiteMapPath is enabled.
            hLink.Enabled = this.Enabled;

            // Set the properties of the HyperLink to
            // match those of the corresponding SiteMapNode.
            hLink.NavigateUrl = item.SiteMapNode.Url;
            hLink.Text        = item.SiteMapNode.Title;
            if (ShowToolTips) {
                hLink.ToolTip = item.SiteMapNode.Description;
            }

            // Apply styles or templates to the HyperLink here.
            // ...
            // ...

            // Add the item to the Controls collection.
            item.Controls.Add(hLink);

            AddDropDownListAfterCurrentNode(item);
        }
        else {
            base.InitializeItem(item);
        }
    }
    private void AddDropDownListAfterCurrentNode(SiteMapNodeItem item) {

        SiteMapNodeCollection childNodes = item.SiteMapNode.ChildNodes;

        // Only do this work if there are child nodes.
        if (childNodes != null) {

            // Add another PathSeparator after the CurrentNode.
            SiteMapNodeItem finalSeparator =
                new SiteMapNodeItem(item.ItemIndex,
                                    SiteMapNodeItemType.PathSeparator);

            SiteMapNodeItemEventArgs eventArgs =
                new SiteMapNodeItemEventArgs(finalSeparator);

            InitializeItem(finalSeparator);
            // Call OnItemCreated every time a SiteMapNodeItem is
            // created and initialized.
            OnItemCreated(eventArgs);

            // The pathSeparator does not bind to any SiteMapNode, so
            // do not call DataBind on the SiteMapNodeItem.
            item.Controls.Add(finalSeparator);

            // Create a DropDownList and populate it with the children of the
            // CurrentNode. There are no styles or templates that are applied
            // to the DropDownList control. If OnSelectedIndexChanged is raised,
            // the event handler redirects to the page selected.
            // The CurrentNode has child nodes.
            DropDownList ddList = new DropDownList();
            ddList.AutoPostBack = true;

            ddList.SelectedIndexChanged += new EventHandler(this.DropDownNavPathEventHandler);

            // Add a ListItem to the DropDownList for every node in the
            // SiteMapNodes collection.
            foreach (SiteMapNode node in childNodes) {
                ddList.Items.Add(new ListItem(node.Title, node.Url));
            }

            item.Controls.Add(ddList);
        }
    }

    // The sender is the DropDownList.
    private void DropDownNavPathEventHandler(object sender,EventArgs e) {
        DropDownList ddL = sender as DropDownList;

        // Redirect to the page the user chose.
        if (Context != null)
            Context.Response.Redirect(ddL.SelectedValue);
    }
}
Imports System.Collections
Imports System.ComponentModel
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace Samples.AspNet

' The DropDownNavigationPath is a class that extends the SiteMapPath
' control and renders a DropDownList after the CurrentNode. The
' DropDownList displays a list of pages found further down the site map
' hierarchy from the current one. Selecting an item in the DropDownList
' redirects to that page.
'
' For simplicity, the DropDownNavigationPath assumes the
' RootToCurrent PathDirection, and does not apply styles
' or templates the current node.
'
<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class DropDownNavigationPath
   Inherits SiteMapPath

   ' Override the InitializeItem method to add a PathSeparator
   ' and DropDownList to the current node.
   Protected Overrides Sub InitializeItem(item As SiteMapNodeItem)

      ' The only node that must be handled is the CurrentNode.
      If item.ItemType = SiteMapNodeItemType.Current Then
         Dim hLink As New HyperLink()

         ' No Theming for the HyperLink.
         hLink.EnableTheming = False
         ' Enable the link of the SiteMapPath is enabled.
         hLink.Enabled = Me.Enabled

         ' Set the properties of the HyperLink to
         ' match those of the corresponding SiteMapNode.
         hLink.NavigateUrl = item.SiteMapNode.Url
         hLink.Text = item.SiteMapNode.Title
         If ShowToolTips Then
            hLink.ToolTip = item.SiteMapNode.Description
         End If

         ' Apply styles or templates to the HyperLink here.
         ' ...
         ' ...
         ' Add the item to the Controls collection.
         item.Controls.Add(hLink)

         AddDropDownListAfterCurrentNode(item)
      Else
         MyBase.InitializeItem(item)
      End If
   End Sub

   Private Sub AddDropDownListAfterCurrentNode(item As SiteMapNodeItem)

      Dim childNodes As SiteMapNodeCollection = item.SiteMapNode.ChildNodes

      ' Only do this work if there are child nodes.
      If Not (childNodes Is Nothing) Then

         ' Add another PathSeparator after the CurrentNode.
         Dim finalSeparator As New SiteMapNodeItem(item.ItemIndex, SiteMapNodeItemType.PathSeparator)

         Dim eventArgs As New SiteMapNodeItemEventArgs(finalSeparator)

         InitializeItem(finalSeparator)
         ' Call OnItemCreated every time a SiteMapNodeItem is
         ' created and initialized.
         OnItemCreated(eventArgs)

         ' The pathSeparator does not bind to any SiteMapNode, so
         ' do not call DataBind on the SiteMapNodeItem.
         item.Controls.Add(finalSeparator)

         ' Create a DropDownList and populate it with the children of the
         ' CurrentNode. There are no styles or templates that are applied
         ' to the DropDownList control. If OnSelectedIndexChanged is raised,
         ' the event handler redirects to the page selected.
         ' The CurrentNode has child nodes.
         Dim ddList As New DropDownList()
         ddList.AutoPostBack = True

         AddHandler ddList.SelectedIndexChanged, AddressOf Me.DropDownNavPathEventHandler

         ' Add a ListItem to the DropDownList for every node in the
         ' SiteMapNodes collection.
         Dim node As SiteMapNode
         For Each node In  childNodes
            ddList.Items.Add(New ListItem(node.Title, node.Url))
         Next node

         item.Controls.Add(ddList)
      End If
   End Sub

   ' The sender is the DropDownList.
   Private Sub DropDownNavPathEventHandler(sender As Object, e As EventArgs)
      Dim ddL As DropDownList = CType(sender, DropDownList)

      ' Redirect to the page the user chose.
      If Not (Context Is Nothing) Then
         Context.Response.Redirect(ddL.SelectedValue)
      End If

   End Sub
End Class
End Namespace

備註

本主題內容:

簡介

控制項 SiteMapPath 是一個網站導覽控制項,可反映 物件所提供的 SiteMap 資料。 它提供節省空間的方式來輕鬆流覽網站,並做為目前顯示頁面在網站內之參考點。 這種類型的控制項通常稱為階層連結或眼球,因為它會顯示超連結頁面名稱的階層路徑,以提供從目前位置逸出頁面階層。 SiteMapDataSource. SiteMapPath對於具有深層階層式頁面結構的月臺很有用,但在 TreeView 頁面上,或 Menu 可能需要太多空間。

控制項 SiteMapPath 會直接與您的網站網站地圖資料搭配運作。 如果您在網站地圖中未代表的頁面使用它,則不會顯示。 如需網站地圖的詳細資訊,請參閱 ASP.NET 網站導覽

節點

SiteMapPath是由節點所組成。 路徑中的每個專案稱為節點,並以 物件表示 SiteMapNodeItem 。 錨定路徑並代表階層式樹狀結構基底的節點稱為根節點。 代表目前顯示頁面的節點是目前的節點。 目前節點與根節點之間的任何其他節點都是父節點。 下表描述三種不同的節點類型。

節點類型 描述
root 錨定階層式節點集的節點。
父系 (parent) 具有一或多個子節點,但不是目前節點的節點。
目前的 表示目前顯示頁面的節點。

節點外觀

SiteMapPath 顯示的每個節點都是 HyperLink 您可以套用範本或樣式的 或 Literal 控制項。 範本和樣式會根據兩個優先順序規則套用至節點:

  • 如果為節點定義範本,則會覆寫為節點定義的任何樣式。

  • 節點類型特有的範本和樣式會覆寫針對所有節點定義的一般範本和樣式。

NodeStyleNodeTemplate 屬性會套用至所有節點,而不論其節點類型為何。 如果同時定義這兩個屬性,則會 NodeTemplate 優先使用 。

CurrentNodeTemplateCurrentNodeStyle 屬性會套用至代表目前顯示頁面的節點。 NodeTemplate如果 除了 CurrentNodeTemplate 定義 ,則會忽略它。 NodeStyle如果 除了 定義 之外 CurrentNodeStyle ,還會與 CurrentNodeStyle 合併,以建立合併的樣式。 這個合併樣式會使用 的所有專案 CurrentNodeStyle ,加上與 衝突 CurrentNodeStyle 之 的任何其他專案 NodeStyle

RootNodeTemplateRootNodeStyle 屬性會套用至代表網站導覽階層根目錄的節點。 NodeTemplate如果 除了 RootNodeTemplate 定義 ,則會忽略它。 NodeStyle如果 除了 定義 之外 RootNodeStyle ,還會與 RootNodeStyle 合併,以建立合併的樣式。 這個合併的樣式會使用 的所有專案 RootNodeStyle ,加上 與 衝突 CurrentNodeStyle 的任何其他元素 NodeStyle 。 最後,如果目前顯示的頁面是網站的根頁面,則會使用 和 RootNodeStyleRootNodeTemplate 而不是 CurrentNodeTemplateCurrentNodeStyle

控制項 SiteMapPath 會使用 屬性所 SiteMapProvider 識別的網站地圖提供者做為其網站導覽資訊的資料來源。 如果未指定提供者,它會使用 屬性中所 SiteMap.Provider 識別之網站的預設提供者。 一般而言,這是 ASP.NET 的預設網站地圖提供者實例。 XmlSiteMapProvider SiteMapPath如果在網站中使用控制項,但未設定任何網站地圖提供者,控制項會 HttpException 擲回例外狀況。

事件

控制項 SiteMapPath 也會提供您可以針對的事件進行程式設計。 這可讓您在事件發生時執行自訂常式。 下表列出 控制項所支援 SiteMapPath 的事件。

事件 描述
ItemCreated 發生于 SiteMapPath 控制項第一次建立 SiteMapNodeItem ,並將它與 SiteMapNode 產生關聯時。
ItemDataBound 發生于 系結至 所包含的 SiteMapNode 網站地圖資料時 SiteMapNodeItem

自訂 SiteMapPath 控制項

衍生自 SiteMapPathInitializeItem 類別會覆寫 方法,以自訂 SiteMapNodeItem 導覽控制項所包含的控制項。 若要完整控制物件建立和新增至 SiteMapPath 的方式 SiteMapNodeItem ,衍生類別會覆寫 CreateControlHierarchy 方法。

Accessibility

如需如何設定此控制項以產生符合協助工具標準的標記的相關資訊,請參閱 Visual Studio 中的協助工具,以及 ASP.NETASP.NET 控制項和協助工具

宣告式語法

<asp:SiteMapPath
    AccessKey="string"
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
        Inset|Outset"
    BorderWidth="size"
    CssClass="string"
    Enabled="True|False"
    EnableTheming="True|False"
    EnableViewState="True|False"
    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
        Large|X-Large|XX-Large"
    Font-Strikeout="True|False"
    Font-Underline="True|False"
    ForeColor="color name|#dddddd"
    Height="size"
    ID="string"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnItemCreated="ItemCreated event handler"
    OnItemDataBound="ItemDataBound event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    ParentLevelsDisplayed="integer"
    PathDirection="RootToCurrent|CurrentToRoot"
    PathSeparator="string"
    RenderCurrentNodeAsLink="True|False"
    runat="server"
    ShowToolTips="True|False"
    SiteMapProvider="string"
    SkinID="string"
    SkipLinkText="string"
    Style="string"
    TabIndex="integer"
    ToolTip="string"
    Visible="True|False"
    Width="size"
>
        <CurrentNodeStyle />
        <CurrentNodeTemplate>
            <!-- child controls -->
        </CurrentNodeTemplate>
        <NodeStyle />
        <NodeTemplate>
            <!-- child controls -->
        </NodeTemplate>
        <PathSeparatorStyle />
        <PathSeparatorTemplate>
            <!-- child controls -->
        </PathSeparatorTemplate>
        <RootNodeStyle />
        <RootNodeTemplate>
            <!-- child controls -->
        </RootNodeTemplate>
</asp:SiteMapPath>

建構函式

SiteMapPath()

初始化 SiteMapPath 類別的新執行個體。

屬性

AccessKey

取得或設定便捷鍵 (Access Key),可讓您快速巡覽至 Web 伺服器控制項。

(繼承來源 WebControl)
Adapter

針對控制項取得瀏覽器的特定配置器。

(繼承來源 Control)
AppRelativeTemplateSourceDirectory

取得或設定包含了此控制項之 PageUserControl 物件的相對應用程式虛擬目錄。

(繼承來源 Control)
Attributes

取得任意屬性 (Attribute) 的集合 (只供呈現),不與控制項上的屬性 (Property) 對應。

(繼承來源 WebControl)
BackColor

取得或設定 Web 伺服器控制項的背景色彩。

(繼承來源 WebControl)
BindingContainer

取得包含了此控制項之資料繫結的控制項。

(繼承來源 Control)
BorderColor

取得或設定 Web 控制項的框線色彩。

(繼承來源 WebControl)
BorderStyle

取得或設定 Web 伺服器控制項的框線樣式。

(繼承來源 WebControl)
BorderWidth

取得或設定 Web 伺服器控制項的框線寬度。

(繼承來源 WebControl)
ChildControlsCreated

取得值,指出是否已經建立伺服器控制項的子控制項。

(繼承來源 Control)
ClientID

取得 ASP.NET 所產生之 HTML 標記的控制項識別碼。

(繼承來源 Control)
ClientIDMode

取得或設定用來產生 ClientID 屬性值的演算法。

(繼承來源 Control)
ClientIDSeparator

取得字元值,表示在 ClientID 屬性中所使用的分隔字元。

(繼承來源 Control)
Context

取得與目前 Web 要求的伺服器控制項關聯的 HttpContext 物件。

(繼承來源 Control)
Controls

取得表示 ControlCollection 中之子控制項的 CompositeControl 物件。

(繼承來源 CompositeControl)
ControlStyle

取得 Web 伺服器控制項的樣式。 這個屬性主要由控制項開發人員使用。

(繼承來源 WebControl)
ControlStyleCreated

取得值,指出 Style 物件是否已經為 ControlStyle 屬性建立。 這個屬性主要由控制項開發人員使用。

(繼承來源 WebControl)
CssClass

取得或設定用戶端上 Web 伺服器控制項所呈現的階層式樣式表 (CSS)。

(繼承來源 WebControl)
CurrentNodeStyle

取得用於目前節點顯示文字的樣式。

CurrentNodeTemplate

取得或設定控制項樣板,讓表示目前顯示網頁的網站巡覽路徑節點使用。

DataItemContainer

如果命名容器實作 IDataItemContainer,則取得命名容器的參考。

(繼承來源 Control)
DataKeysContainer

如果命名容器實作 IDataKeysControl,則取得命名容器的參考。

(繼承來源 Control)
DesignMode

取得值,指出控制項是否正用於設計介面上。

(繼承來源 Control)
Enabled

取得或設定值,指出 Web 伺服器控制項是否啟用。

(繼承來源 WebControl)
EnableTheming

取得或設定值,指出佈景主題是否套用至此控制項。

(繼承來源 WebControl)
EnableViewState

取得或設定值,該值表示伺服器控制項是否對要求的用戶端而言保持其檢視狀態,以及它包含的任何子控制項狀態。

(繼承來源 Control)
Events

取得控制項事件處理常式委派 (Delegate) 的清單。 這個屬性是唯讀的。

(繼承來源 Control)
Font

取得與 Web 伺服器控制項關聯的字型屬性。

(繼承來源 WebControl)
ForeColor

取得或設定 Web 伺服器控制項的前景色彩 (通常是文字的色彩)。

(繼承來源 WebControl)
HasAttributes

取得值,指出控制項是否已經設定屬性。

(繼承來源 WebControl)
HasChildViewState

取得值,指出目前伺服器控制項的子控制項是否有任何已儲存的檢視狀態設定。

(繼承來源 Control)
Height

取得或設定 Web 伺服器控制項的高度。

(繼承來源 WebControl)
ID

取得或設定指派給伺服器控制項的程式設計識別項。

(繼承來源 Control)
IdSeparator

取得用來分隔控制項識別項的字元。

(繼承來源 Control)
IsChildControlStateCleared

取得值,指出這個控制項中所包含的控制項是否有控制項狀態。

(繼承來源 Control)
IsEnabled

取得值,指出是否啟用控制項。

(繼承來源 WebControl)
IsTrackingViewState

取得值,指出伺服器控制項是否正在儲存檢視狀態的變更。

(繼承來源 Control)
IsViewStateEnabled

取得值,指出這個控制項是否已啟用檢視狀態。

(繼承來源 Control)
LoadViewStateByID

取得值,指出控制項是否依 ID (而不是索引) 參與載入其檢視狀態。

(繼承來源 Control)
NamingContainer

取得伺服器控制項命名容器的參考,其建立唯一命名空間,在具有相同 ID 屬性值的伺服器控制項之間作區別。

(繼承來源 Control)
NodeStyle

取得用於網站巡覽路徑中所有節點顯示文字的樣式。

NodeTemplate

取得或設定控制項樣板以供網站巡覽路徑的所有功能節點使用。

Page

取得含有伺服器控制項的 Page 執行個體的參考。

(繼承來源 Control)
Parent

在網頁控制階層架構中取得伺服器控制項之父控制項的參考。

(繼承來源 Control)
ParentLevelsDisplayed

取得或設定控制項顯示的父節點層級數目,相對於目前顯示的節點。

PathDirection

取得或設定巡覽路徑節點呈現的順序。

PathSeparator

取得或設定在呈現巡覽路徑中分隔 SiteMapPath 節點的字串。

PathSeparatorStyle

取得用於 PathSeparator 字串的樣式。

PathSeparatorTemplate

取得或設定控制項樣板以供網站巡覽路徑的路徑分隔符號使用。

Provider

取得或設定與 Web 伺服器控制項關聯的 SiteMapProvider

RenderCurrentNodeAsLink

指出表示目前顯示網頁的網站巡覽節點是否以超連結的方式呈現。

RenderingCompatibility

取得值,這個值會指定將與呈現 HTML 相容的 ASP.NET 版本。

(繼承來源 Control)
RootNodeStyle

取得根節點顯示文字的樣式。

RootNodeTemplate

取得或設定控制項樣板以供網站巡覽路徑的根節點使用。

ShowToolTips

取得或設定值,指出 SiteMapPath 控制項是否要為超連結巡覽節點撰寫其他的超連結屬性。 依據用戶端的支援,當滑鼠停留在擁有其他屬性集的超連結上,則會顯示工具提示。

Site

當呈現在設計介面上時,取得裝載目前控制項之容器的資訊。

(繼承來源 Control)
SiteMapProvider

取得或設定用於呈現網站巡覽控制項的 SiteMapProvider 名稱。

SkinID

取得或設定要套用至控制項的面板。

(繼承來源 WebControl)
SkipLinkText

取得或設定用於呈現替代文字讓螢幕助讀員略過控制項內容的值。

Style

取得文字屬性的集合,將呈現為 Web 伺服器控制項的外部標記上的樣式屬性。

(繼承來源 WebControl)
SupportsDisabledAttribute

取得值,這個值表示當控制項的 disabled 屬性為 IsEnabled 時,控制項是否應該將呈現之 HTML 項目的 false 屬性設為 "disabled"。

(繼承來源 CompositeControl)
TabIndex

取得或設定 Web 伺服器控制項的定位索引。

(繼承來源 WebControl)
TagKey

取得對應至這個 Web 伺服器控制項的 HtmlTextWriterTag 值。 這個屬性主要由控制項開發人員使用。

(繼承來源 WebControl)
TagName

取得控制項標記的名稱。 這個屬性主要由控制項開發人員使用。

(繼承來源 WebControl)
TemplateControl

取得或設定包含了此控制項之樣板的參考。

(繼承來源 Control)
TemplateSourceDirectory

取得包含目前伺服器控制項的 PageUserControl 的虛擬目錄。

(繼承來源 Control)
ToolTip

取得或設定當滑鼠指標停留在 Web 伺服器控制項時顯示的文字。

(繼承來源 WebControl)
UniqueID

取得伺服器控制項唯一的、符合階層架構的識別項。

(繼承來源 Control)
ValidateRequestMode

取得或設定值,指出控制項是否對來自瀏覽器的用戶端輸入檢查潛在的危險值。

(繼承來源 Control)
ViewState

取得狀態資訊的字典,允許您在相同網頁的多個要求之間,儲存和還原伺服器控制項的檢視狀態。

(繼承來源 Control)
ViewStateIgnoresCase

取得值,指出 StateBag 物件是否不區分大小寫。

(繼承來源 Control)
ViewStateMode

取得或設定這個控制項的檢視狀態模式。

(繼承來源 Control)
Visible

取得或設定值,指出伺服器控制項是否會轉譯為頁面上的 UI。

(繼承來源 Control)
Width

取得或設定 Web 伺服器控制項的寬度。

(繼承來源 WebControl)

方法

AddAttributesToRender(HtmlTextWriter)

將需要呈現的 HTML 屬性和樣式加入至指定的 HtmlTextWriterTag 中。 這個方法主要由控制項開發人員使用。

(繼承來源 WebControl)
AddedControl(Control, Int32)

在子控制項加入 Control 物件的 Controls 集合後呼叫。

(繼承來源 Control)
AddParsedSubObject(Object)

通知伺服器控制項,XML 或 HTML 項目已剖析,並將項目加入伺服器控制項的 ControlCollection 物件中。

(繼承來源 Control)
ApplyStyle(Style)

將指定樣式的任何非空白項目加入到 Web 控制項中,覆寫控制項的任何現有的樣式項目。 這個方法主要由控制項開發人員使用。

(繼承來源 WebControl)
ApplyStyleSheetSkin(Page)

將頁面樣式表中所定義的樣式屬性套用至控制項。

(繼承來源 Control)
BeginRenderTracing(TextWriter, Object)

開始進行轉譯資料的設計階段追蹤。

(繼承來源 Control)
BuildProfileTree(String, Boolean)

收集伺服器控制項的相關資訊,並在頁面啟用追蹤時將此資訊傳遞至 Trace 屬性以顯示之。

(繼承來源 Control)
ClearCachedClientID()

將快取的 ClientID 值設定為 null

(繼承來源 Control)
ClearChildControlState()

刪除伺服器控制項之子控制項的控制項狀態資訊。

(繼承來源 Control)
ClearChildState()

刪除所有伺服器控制項之子控制項的檢視狀態和控制項狀態資訊。

(繼承來源 Control)
ClearChildViewState()

刪除所有伺服器控制項之子控制項的檢視狀態資訊。

(繼承來源 Control)
ClearEffectiveClientIDMode()

將目前的控制項執行個體和任何子控制項的 ClientIDMode 屬性設定為 Inherit

(繼承來源 Control)
CopyBaseAttributes(WebControl)

將不被 Style 物件封裝的屬性從指定的 Web 伺服器控制項複製到呼叫這個方法的 Web 伺服器控制項上。 這個方法主要由控制項開發人員使用。

(繼承來源 WebControl)
CreateChildControls()

清除目前的子控制項集合,然後藉由呼叫 CreateControlHierarchy() 方法重建。

CreateControlCollection()

建立新的 ControlCollection 物件來保存伺服器控制項的子控制項 (常值和伺服器)。

(繼承來源 Control)
CreateControlHierarchy()

檢查 SiteMapProvider 所提供的網站導覽結構,並且根據功能節點所定義的樣式和樣板來建立子控制項集合。

CreateControlStyle()

建立樣式物件,這個物件被 WebControl 類別內部使用,以實作所有的樣式相關屬性。 這個方法主要由控制項開發人員使用。

(繼承來源 WebControl)
DataBind()

繫結資料來源至 SiteMapPath 控制項以及其子控制項。

DataBind(Boolean)

使用會引發 DataBinding 事件的選項,繫結資料來源至叫用的伺服器控制項及其所有子控制項。

(繼承來源 Control)
DataBindChildren()

繫結資料來源至伺服器控制項的子控制項。

(繼承來源 Control)
Dispose()

啟用伺服器控制項,在它從記憶體釋放之前執行最後清除。

(繼承來源 Control)
EndRenderTracing(TextWriter, Object)

結束轉譯資料的設計階段追蹤。

(繼承來源 Control)
EnsureChildControls()

判斷伺服器控制項是否包含子控制項。 如果不包含,則建立子控制項。

(繼承來源 Control)
EnsureID()

為尚未指定識別項的控制項,建立識別項。

(繼承來源 Control)
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
FindControl(String)

在目前命名容器搜尋具有指定 id 參數的伺服器控制項。

(繼承來源 Control)
FindControl(String, Int32)

使用指定的 id 和有助於搜尋之 pathOffset 參數中所指定的整數,在目前的命名容器中搜尋伺服器控制項。 您不應該覆寫這個版本的 FindControl 方法。

(繼承來源 Control)
Focus()

設定控制項的輸入焦點。

(繼承來源 Control)
GetDesignModeState()

取得控制項的設計階段資料。

(繼承來源 Control)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetRouteUrl(Object)

取得會對應於一組路由參數的 URL。

(繼承來源 Control)
GetRouteUrl(RouteValueDictionary)

取得會對應於一組路由參數的 URL。

(繼承來源 Control)
GetRouteUrl(String, Object)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。

(繼承來源 Control)
GetRouteUrl(String, RouteValueDictionary)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。

(繼承來源 Control)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
GetUniqueIDRelativeTo(Control)

傳回指定之控制項 UniqueID 屬性的前置部分。

(繼承來源 Control)
HasControls()

判斷伺服器控制項是否包含任何子控制項。

(繼承來源 Control)
HasEvents()

傳回值,指出控制項或任何子控制項的事件是否已註冊。

(繼承來源 Control)
InitializeItem(SiteMapNodeItem)

填入 (Populate) 表示 SiteMapNodeItem 之 Web 伺服器控制項的 SiteMapNode,以及一組根據節點功能和節點特定樣板與樣式的子控制項。

IsLiteralContent()

判斷伺服器控制項是否只儲存常值內容。

(繼承來源 Control)
LoadControlState(Object)

SaveControlState() 方法所儲存的上一頁要求中,還原控制項狀態資訊。

(繼承來源 Control)
LoadViewState(Object)

從上一個使用 SaveViewState() 方法儲存的要求中,還原檢視狀態資訊。

MapPathSecure(String)

擷取虛擬絕對路徑或相對路徑所對應至的實體路徑。

(繼承來源 Control)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
MergeStyle(Style)

將指定樣式的任何非空白項目複製到 Web 控制項,但不覆寫控制項的任何現有樣式項目。 這個方法主要由控制項開發人員使用。

(繼承來源 WebControl)
OnBubbleEvent(Object, EventArgs)

決定伺服器控制項的事件是否要在頁面的 UI 伺服器控制項階層架構中向上傳遞。

(繼承來源 Control)
OnDataBinding(EventArgs)

覆寫 OnDataBinding(EventArgs) 類別的 CompositeControl 方法,並且引發 DataBinding 事件。

OnInit(EventArgs)

引發 Init 事件。

(繼承來源 Control)
OnItemCreated(SiteMapNodeItemEventArgs)

引發 ItemCreated 控制項的 SiteMapPath 事件。

OnItemDataBound(SiteMapNodeItemEventArgs)

引發 ItemDataBound 控制項的 SiteMapPath 事件。

OnLoad(EventArgs)

引發 Load 事件。

(繼承來源 Control)
OnPreRender(EventArgs)

引發 PreRender 事件。

(繼承來源 Control)
OnUnload(EventArgs)

引發 Unload 事件。

(繼承來源 Control)
OpenFile(String)

取得用來讀取檔案的 Stream

(繼承來源 Control)
RaiseBubbleEvent(Object, EventArgs)

指派事件的任何來源和它的資訊至控制項的父控制項。

(繼承來源 Control)
RecreateChildControls()

重新建立衍生自 CompositeControl 之控制項的子控制項。

(繼承來源 CompositeControl)
RemovedControl(Control)

Control 物件的 Controls 集合中移除子控制項之後呼叫。

(繼承來源 Control)
Render(HtmlTextWriter)

CompositeControl 內容寫入指定的 HtmlTextWriter 物件,以顯示於用戶端。

RenderBeginTag(HtmlTextWriter)

將控制項的 HTML 開頭標記呈現在指定的寫入器中。 這個方法主要由控制項開發人員使用。

(繼承來源 WebControl)
RenderChildren(HtmlTextWriter)

將伺服器控制項子系的內容輸出至提供的 HtmlTextWriter 物件,再由這個物件在用戶端上寫入要轉譯的內容。

(繼承來源 Control)
RenderContents(HtmlTextWriter)

SiteMapPath 控制項中呈現節點。

RenderControl(HtmlTextWriter)

將伺服器控制項內容輸出至提供的 HtmlTextWriter 物件,並在啟用追蹤時儲存控制項的追蹤資訊。

(繼承來源 Control)
RenderControl(HtmlTextWriter, ControlAdapter)

使用提供的 HtmlTextWriter 物件,輸出伺服器控制項內容至提供的 ControlAdapter 物件。

(繼承來源 Control)
RenderEndTag(HtmlTextWriter)

將控制項的 HTML 結尾標記呈現至指定的寫入器。 這個方法主要由控制項開發人員使用。

(繼承來源 WebControl)
ResolveAdapter()

取得負責呈現指定之控制項的控制項配置器。

(繼承來源 Control)
ResolveClientUrl(String)

取得瀏覽器可使用的 URL。

(繼承來源 Control)
ResolveUrl(String)

將 URL 轉換為要求用戶端可使用的 URL。

(繼承來源 Control)
SaveControlState()

儲存頁面回傳至伺服器以來,所發生的任何伺服器控制項狀態變更。

(繼承來源 Control)
SaveViewState()

儲存變更以檢視 SiteMapPath 控制項的狀態。

SetDesignModeState(IDictionary)

設定控制項的設計階段資料。

(繼承來源 Control)
SetRenderMethodDelegate(RenderMethod)

指定事件處理常式委派,以呈現伺服器控制項及其內容至其父控制項。

(繼承來源 Control)
SetTraceData(Object, Object)

使用追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。

(繼承來源 Control)
SetTraceData(Object, Object, Object)

使用追蹤的物體、追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。

(繼承來源 Control)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
TrackViewState()

追蹤 SiteMapPath 控制項檢視狀態的變更。

事件

DataBinding

發生於伺服器控制項繫結至資料來源時。

(繼承來源 Control)
Disposed

發生於伺服器控制項從記憶體釋放時,這是在要求 ASP.NET 網頁時,伺服器控制項生命週期的最後階段。

(繼承來源 Control)
Init

發生於初始化伺服器控制項時,是其生命週期中的第一個步驟。

(繼承來源 Control)
ItemCreated

發生在由 SiteMapNodeItem 所建立的 SiteMapPath,且它與對應的 SiteMapNode 關聯時。 OnItemCreated(SiteMapNodeItemEventArgs) 方法會引發這個事件。

ItemDataBound

發生在 SiteMapNodeItem 已由 SiteMapNode 繫結至其基礎 SiteMapPath 資料後。 OnItemDataBound(SiteMapNodeItemEventArgs) 方法會引發這個事件。

Load

發生於載入伺服器控制項至 Page 物件時。

(繼承來源 Control)
PreRender

Control 物件載入之後但在呈現之前發生。

(繼承來源 Control)
Unload

發生於伺服器控制項從記憶體卸載時。

(繼承來源 Control)

明確介面實作

IAttributeAccessor.GetAttribute(String)

使用指定的名稱,取得 Web 控制項的屬性。

(繼承來源 WebControl)
IAttributeAccessor.SetAttribute(String, String)

將 Web 控制項的屬性設定為指定的名稱和值。

(繼承來源 WebControl)
ICompositeControlDesignerAccessor.RecreateChildControls()

讓設計工具能在設計階段環境中重新建立複合控制項的子控制項集合。

(繼承來源 CompositeControl)
IControlBuilderAccessor.ControlBuilder

如需這個成員的說明,請參閱 ControlBuilder

(繼承來源 Control)
IControlDesignerAccessor.GetDesignModeState()

如需這個成員的說明,請參閱 GetDesignModeState()

(繼承來源 Control)
IControlDesignerAccessor.SetDesignModeState(IDictionary)

如需這個成員的說明,請參閱 SetDesignModeState(IDictionary)

(繼承來源 Control)
IControlDesignerAccessor.SetOwnerControl(Control)

如需這個成員的說明,請參閱 SetOwnerControl(Control)

(繼承來源 Control)
IControlDesignerAccessor.UserData

如需這個成員的說明,請參閱 UserData

(繼承來源 Control)
IDataBindingsAccessor.DataBindings

如需這個成員的說明,請參閱 DataBindings

(繼承來源 Control)
IDataBindingsAccessor.HasDataBindings

如需這個成員的說明,請參閱 HasDataBindings

(繼承來源 Control)
IExpressionsAccessor.Expressions

如需這個成員的說明,請參閱 Expressions

(繼承來源 Control)
IExpressionsAccessor.HasExpressions

如需這個成員的說明,請參閱 HasExpressions

(繼承來源 Control)
IParserAccessor.AddParsedSubObject(Object)

如需這個成員的說明,請參閱 AddParsedSubObject(Object)

(繼承來源 Control)

擴充方法

FindDataSourceControl(Control)

傳回與指定之控制項的資料控制項相關聯的資料來源。

FindFieldTemplate(Control, String)

傳回在指定之控制項的命名容器中所指定資料行的欄位樣板。

FindMetaTable(Control)

傳回包含資料控制項的中繼資料表物件。

GetDefaultValues(INamingContainer)

取得所指定資料控制項的預設值集合。

GetMetaTable(INamingContainer)

取得所指定資料控制項中的資料表中繼資料。

SetMetaTable(INamingContainer, MetaTable)

設定所指定資料控制項中的資料表中繼資料。

SetMetaTable(INamingContainer, MetaTable, IDictionary<String,Object>)

設定所指定資料控制項的資料表中繼資料及預設值對應。

SetMetaTable(INamingContainer, MetaTable, Object)

設定所指定資料控制項的資料表中繼資料及預設值對應。

TryGetMetaTable(INamingContainer, MetaTable)

判斷資料表中繼資料是否可供使用。

EnableDynamicData(INamingContainer, Type)

針對指定的資料控制項啟用動態資料行為。

EnableDynamicData(INamingContainer, Type, IDictionary<String,Object>)

針對指定的資料控制項啟用動態資料行為。

EnableDynamicData(INamingContainer, Type, Object)

針對指定的資料控制項啟用動態資料行為。

適用於

另請參閱