Menu 類別

定義

顯示 ASP.NET Web 網頁中的功能表。Displays a menu in an ASP.NET Web page.

public ref class Menu : System::Web::UI::WebControls::HierarchicalDataBoundControl, System::Web::UI::INamingContainer, System::Web::UI::IPostBackEventHandler
[System.Web.UI.ControlValueProperty("SelectedValue")]
public class Menu : System.Web.UI.WebControls.HierarchicalDataBoundControl, System.Web.UI.INamingContainer, System.Web.UI.IPostBackEventHandler
[<System.Web.UI.ControlValueProperty("SelectedValue")>]
type Menu = class
    inherit HierarchicalDataBoundControl
    interface IPostBackEventHandler
    interface INamingContainer
Public Class Menu
Inherits HierarchicalDataBoundControl
Implements INamingContainer, IPostBackEventHandler
繼承
屬性
實作

範例

本主題提供具有原始程式碼的 Visual Studio 網站專案:下載A Visual Studio Web site project with source code is available to accompany this topic: Download.

下列程式碼範例示範如何 Menu 使用宣告式語法來建立具有靜態功能表項目的控制項。The following code example demonstrates how to create a Menu control with static menu items using declarative syntax.


<%@ 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" >

  <!-- For the hover styles of the Menu control to  -->
  <!-- work correctly, you must include this head   -->
  <!-- element.                                     -->
  <head runat="server">
    <title>Menu Declarative Example</title>
</head>

  <body>
    <form id="form1" runat="server">
    
      <h3>Menu Declarative Example</h3>
    
      <!-- Use declarative syntax to create the   -->
      <!-- menu structure. Submenu items are      -->
      <!-- created by nesting them in parent menu -->
      <!-- items.                                 -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        font-names="Arial" 
        target="_blank"  
        runat="server">
        
        <staticmenuitemstyle backcolor="LightSteelBlue"
          forecolor="Black"/>
        <statichoverstyle backcolor="LightSkyBlue"/>
        <dynamicmenuitemstyle backcolor="Black"
          forecolor="Silver"/>
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>
      
        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            tooltip="Home">
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Movies"
              tooltip="Movies">
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                tooltip="Action"/>
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

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

  <!-- For the hover styles of the Menu control to  -->
  <!-- work correctly, you must include this head   -->
  <!-- element.                                     -->
  <head runat="server">
    <title>Menu Declarative Example</title>
</head>

  <body>
    <form id="form1" runat="server">
    
      <h3>Menu Declarative Example</h3>
    
      <!-- Use declarative syntax to create the   -->
      <!-- menu structure. Submenu items are      -->
      <!-- created by nesting them in parent menu -->
      <!-- items.                                 -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        font-names="Arial" 
        target="_blank"  
        runat="server">
        
        <staticmenuitemstyle backcolor="LightSteelBlue"
          forecolor="Black"/>
        <statichoverstyle backcolor="LightSkyBlue"/>
        <dynamicmenuitemstyle backcolor="Black"
          forecolor="Silver"/>
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>
      
        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            tooltip="Home">
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Movies"
              tooltip="Movies">
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                tooltip="Action"/>
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

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

下列程式碼範例示範如何將控制項系結 MenuSiteMapDataSource 控制項。The following code example demonstrates how to bind the Menu control to a SiteMapDataSource control. 為了讓此範例正確運作,您必須將下列範例網站地圖資料複製到名為 System.web 的檔案。For this example to work correctly, you must copy the sample site map data below to a file named Web.sitemap.


<%@ 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" >

  <!-- For the hover styles of the Menu control to  -->
  <!-- work correctly, you must include this head   -->
  <!-- element.                                     -->
  <head runat="server">
    <title>Menu DataBinding Example</title>
</head>

  <body>
    <form id="form1" runat="server">
    
      <h3>Menu DataBinding Example</h3>
    
      <!-- Bind the Menu control to a SiteMapDataSource control.  -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        font-names="Arial" 
        target="_blank"
        datasourceid="MenuSource"   
        runat="server">
        
        <staticmenuitemstyle backcolor="LightSteelBlue"
          forecolor="Black"/>
        <statichoverstyle backcolor="LightSkyBlue"/>
        <dynamicmenuitemstyle backcolor="Black"
          forecolor="Silver"/>
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>

      </asp:menu>
      
      <asp:SiteMapDataSource id="MenuSource"
        runat="server"/>        

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

  <!-- For the hover styles of the Menu control to  -->
  <!-- work correctly, you must include this head   -->
  <!-- element.                                     -->
  <head runat="server">
    <title>Menu DataBinding Example</title>
</head>

  <body>
    <form id="form1" runat="server">
    
      <h3>Menu DataBinding Example</h3>
    
      <!-- Bind the Menu control to a SiteMapDataSource control.  -->
      <asp:menu id="NavigationMenu"
        disappearafter="2000"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Vertical"
        font-names="Arial" 
        target="_blank"
        datasourceid="MenuSource"   
        runat="server">
        
        <staticmenuitemstyle backcolor="LightSteelBlue"
          forecolor="Black"/>
        <statichoverstyle backcolor="LightSkyBlue"/>
        <dynamicmenuitemstyle backcolor="Black"
          forecolor="Silver"/>
        <dynamichoverstyle backcolor="LightSkyBlue"
          forecolor="Black"/>

      </asp:menu>
      
      <asp:SiteMapDataSource id="MenuSource"
        runat="server"/>        

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

以下是前一個範例的範例網站地圖資料。The following is sample site map data for the previous example.

<siteMap>  
  <siteMapNode url="~\Home.aspx"   
    title="Home"  
    description="Home">  
    <siteMapNode url="~\Music.aspx"  
      title="Music"  
      description="Music">  
      <siteMapNode url="~\Classical.aspx"   
        title="Classical"  
        description="Classical"/>  
      <siteMapNode url="~\Rock.aspx"  
        title="Rock"  
        description="Rock"/>  
      <siteMapNode url="~\Jazz.aspx"  
        title="Jazz"  
        description="Jazz"/>  
    </siteMapNode>  
    <siteMapNode url="~\Movies.aspx"  
      title="Movies"  
      description="Movies">  
      <siteMapNode url="~\Action.aspx"  
        title="Action"  
        description="Action"/>  
      <siteMapNode url="~\Drama.aspx"  
        title="Drama"  
        description="Drama"/>  
      <siteMapNode url="~\Musical.aspx"  
        title="Musical"  
        description="Musical"/>  
    </siteMapNode>  
  </siteMapNode>  
</siteMap>  

備註

本主題內容:In this topic:

簡介Introduction

Menu控制項是用來在 ASP.NET 網頁中顯示功能表,而且通常與用於導覽網站的控制項搭配使用 SiteMapDataSourceThe Menu control is used to display a menu in an ASP.NET Web page and is often used in combination with a SiteMapDataSource control for navigating a Web site. Menu控制項支援下列功能:The Menu control supports the following features:

  • 允許將控制項的功能表項目系結至階層式資料來源的資料系結。Data binding that allows the control's menu items to be bound to hierarchal data sources.

  • 透過與控制項整合來流覽網站 SiteMapDataSourceSite navigation through integration with the SiteMapDataSource control.

  • 以程式設計方式存取 Menu 物件模型,以動態建立功能表、填入功能表項目、設定屬性等等。Programmatic access to the Menu object model to dynamically create menus, populate menu items, set properties, and so on.

  • 透過主題、使用者定義的影像、樣式和使用者定義的範本,可自訂的外觀。Customizable appearance through themes, user-defined images, styles, and user-defined templates.

當使用者按一下功能表項目時, Menu 控制項可以導覽至連結的網頁,或只回傳至伺服器。When the user clicks a menu item, the Menu control can either navigate to a linked Web page or simply post back to the server. 如果 NavigateUrl 已設定功能表項目的屬性,控制項就會 Menu 流覽至連結的頁面,否則會將頁面張貼回伺服器進行處理。If the NavigateUrl property of a menu item is set, the Menu control navigates to the linked page; otherwise, it posts the page back to the server for processing. 根據預設,連結的頁面會顯示在與控制項相同的視窗或框架中 MenuBy default, a linked page is displayed in the same window or frame as the Menu control. 若要在不同的視窗或框架中顯示連結的內容,請使用 Target 控制項的屬性 MenuTo display the linked content in a different window or frame, use the Target property of the Menu control.

注意

Target屬性會影響控制項中的每個功能表項目。The Target property affects every menu item in the control. 若要指定個別功能表項目的視窗或框架,請直接設定 Target 物件的屬性 MenuItemTo specify a window or frame for an individual menu item, set the Target property of the MenuItem object directly.

Menu控制項會顯示兩種類型的功能表: [靜態] 功能表和 [動態] 功能表。The Menu control displays two types of menus: a static menu and a dynamic menu. 靜態功能表一律會顯示在控制項中 MenuThe static menu is always displayed in a Menu control. 根據預設,根層級 (層級 0) 的功能表項目會顯示在 [靜態] 功能表中。By default, the menu items at the root level (level 0) are displayed in the static menu. 您可以藉由設定屬性,在靜態功能表內顯示額外的功能表層級 (靜態子功能表) StaticDisplayLevelsYou can display additional menu levels (static submenus) within the static menu by setting the StaticDisplayLevels property. 如果任何層級高於屬性所指定值的) StaticDisplayLevels 會顯示在動態功能表中,則功能表項目 (。Menu items (if any) with a higher level than the value specified by the StaticDisplayLevels property are displayed in a dynamic menu. 只有當使用者將滑鼠指標放在包含動態子功能表的父功能表項目上方時,才會出現動態功能表。A dynamic menu appears only when the user positions the mouse pointer over the parent menu item that contains a dynamic submenu. 動態功能表會在一段時間後自動消失。Dynamic menus automatically disappear after a certain duration. 使用 DisappearAfter 屬性來指定持續時間。Use the DisappearAfter property to specify the duration.

注意

當使用者按一下功能表外部時,動態功能表也會消失。A dynamic menu also disappears when the user clicks outside of the menu.

您也可以藉由設定屬性來限制動態功能表中顯示的層級數目 MaximumDynamicDisplayLevelsYou can also limit the number of levels displayed in a dynamic menu by setting the MaximumDynamicDisplayLevels property. 系統會捨棄高於指定值的功能表層級。Menu levels higher than the specified value are discarded.

注意

Menu控制項的設計不是要在控制項內使用 UpdatePanelThe Menu control is not designed to be used inside an UpdatePanel control. Menu 只能將控制項加入控制項外的頁面 UpdatePanelYou can add the Menu control only to a page outside an UpdatePanel control. UpdatePanel控制項是用來更新頁面的選取區域,而不是使用回傳來更新整個頁面。UpdatePanel controls are used to update selected regions of a page instead of updating the whole page with a postback. 如需詳細資訊,請參閱UpdatePanel 控制項總覽部分頁面呈現總覽For more information, see UpdatePanel Control Overview and Partial-Page Rendering Overview.

Menu控制項是由物件所代表的功能表項目樹狀結構所組成 MenuItemA Menu control is made up of a tree of menu items represented by MenuItem objects. 最上層的功能表項目 (層級 0) 稱為根功能表項目。Menu items at the top level (level 0) are called root menu items. 具有父功能表項目的功能表項目稱為子功能表專案。A menu item that has a parent menu item is called a child menu item. 所有根功能表項目都會儲存在 Items 集合中。All root menu items are stored in the Items collection. 子功能表專案會儲存在父功能表項目目的 ChildItems 集合中。Child menu items are stored in a parent menu item's ChildItems collection.

每個功能表項目都有 TextValue 屬性。Each menu item has a Text and a Value property. 屬性的值 Text 會顯示在 Menu 控制項中,而 Value 屬性則是用來儲存有關功能表項目的任何其他資料,例如傳遞至與功能表項目相關聯之回傳事件的資料。The value of the Text property is displayed in the Menu control, while the Value property is used to store any additional data about the menu item, such as data passed to the postback event associated with the menu item. 按一下時,功能表項目可以導覽至屬性所指示的另一個網頁 NavigateUrlWhen clicked, a menu item can navigate to another Web page indicated by the NavigateUrl property.

注意

如果 NavigateUrl 未設定功能表項目的屬性, Menu 控制項只會在按一下功能表項目時,將頁面提交至伺服器進行處理。If the NavigateUrl property is not set for a menu item, the Menu control simply submits the page to the server for processing when the menu item is clicked.

您也可以藉由設定屬性,選擇性地在功能表項目中顯示影像 ImageUrlYou can also optionally display an image in a menu item by setting the ImageUrl property.

如需功能表項目的詳細資訊,請參閱 MenuItemFor more information on menu items, see MenuItem.

靜態資料Static Data

控制項最簡單的資料模型 Menu 是靜態功能表項目。The simplest data model of the Menu control is static menu items. 若要使用宣告式語法顯示靜態功能表項目,請先在 <Items> 控制項的開頭和結束記號之間,嵌套開頭和結束記號 MenuTo display static menu items using declarative syntax, first nest opening and closing <Items> tags between the opening and closing tags of the Menu control. 接下來,藉由 <asp:MenuItem> 在開頭和結束記號之間嵌套元素來建立功能表結構 <Items>Next, create the menu structure by nesting <asp:MenuItem> elements between the opening and closing <Items> tags. 每個 <asp:MenuItem> 元素都代表控制項中的功能表項目,並對應至 MenuItem 物件。Each <asp:MenuItem> element represents a menu item in the control and maps to a MenuItem object. 您可以設定每個功能表項目的屬性(attribute),方法是設定其元素的屬性(attribute) <asp:MenuItem>You can set the properties of each menu item by setting the attributes of its <asp:MenuItem> element. 若要建立子功能表專案,請在 <asp:MenuItem> 父功能表項目的開頭和結束記號之間,嵌套額外的元素 <asp:MenuItem>To create submenu items, nest additional <asp:MenuItem> elements between the opening and closing <asp:MenuItem> tags of the parent menu item.

系結至資料Binding to Data

Menu控制項可以使用任何階層式資料來源控制項,例如 XmlDataSource 控制項或 SiteMapDataSource 控制項。The Menu control can use any hierarchal data source control, such as an XmlDataSource control or a SiteMapDataSource control. 若要系結至階層式資料來源控制項,請將 DataSourceID 控制項的屬性設 MenuID 資料來源控制項的值。To bind to a hierarchal data source control, set the DataSourceID property of the Menu control to the ID value of the data source control. Menu控制項會自動系結至指定的資料來源控制項。The Menu control automatically binds to the specified data source control. 這是系結至資料的慣用方法。This is the preferred method to bind to data.

當系結至每個資料項目包含多個屬性 (的資料來源時(例如具有數個屬性) 的 XML 元素),功能表項目預設會顯示資料項目的方法所傳回的值 ToStringWhen binding to a data source where each data item contains multiple properties (such as an XML element with several attributes), a menu item displays the value returned by the ToString method of the data item by default. 在 XML 專案的案例中,功能表項目會顯示元素名稱,這會顯示功能表樹的基礎結構,但不是非常實用。In the case of an XML element, the menu item displays the element name, which shows the underlying structure of the menu tree but is not very useful otherwise. 您可以使用 DataBindings 集合來指定功能表項目系結,以將功能表項目系結至特定的資料項目屬性。You can bind a menu item to a specific data item property by using the DataBindings collection to specify menu item bindings. DataBindings集合包含 MenuItemBinding 的物件,會定義資料項目與其系結之功能表項目之間的關聯性。The DataBindings collection contains MenuItemBinding objects that define the relationship between a data item and the menu item it is binding to. 您可以指定系結的準則,以及要在節點中顯示的資料項目屬性。You can specify the criteria for binding and the data item property to display in the node. 如需功能表項目系結的詳細資訊,請參閱 MenuItemBindingFor more information on menu item bindings, see MenuItemBinding.

您無法在控制項中建立空的節點, Menu 方法是將 TextTextField 屬性設定為空字串 ( "" ) 。You cannot create empty nodes in a Menu control by setting the Text or TextField properties to the empty string (""). 將這些屬性設定為空字串,與未設定屬性的效果相同。Setting these properties to the empty string has the same effect as not setting the properties. 在此情況下, Menu 控制項會使用屬性建立預設系結 DataSourceIn that case, the Menu control creates a default binding using the DataSource property. 如需詳細資訊,請參閱系結至資料庫For more information, see Binding to Databases.

自訂使用者介面Customizing the User Interface

有許多方法可以自訂控制項的外觀 MenuThere are many ways to customize the appearance of the Menu control. 首先,您可以藉 Menu 由設定屬性來指定要水準或垂直呈現控制項 OrientationFirst, you can specify whether the Menu control is rendered horizontally or vertically by setting the Orientation property. 您也可以指定不同的樣式 (例如每個功能表項目類型的字型大小和色彩) 。You can also specify a different style (such as font size and color) for each of the menu item types.

如果您使用級聯樣式表 (CSS) 自訂控制項的外觀,請使用內嵌樣式或個別的 CSS 檔案,但不能同時使用兩者。If you use cascading style sheets (CSS) to customize the appearance of the control, use either inline styles or a separate CSS file, but not both. 同時使用內嵌樣式和個別的 CSS 檔案可能會導致非預期的結果。Using both inline styles and a separate CSS file could cause unexpected results. 如需搭配控制項使用樣式表單的詳細資訊,請參閱Web 服務器控制項和 CSS 樣式For more information on using style sheets with controls, see Web Server Controls and CSS Styles.

下表列出可用的功能表項目樣式。The following table lists the available menu item styles.

功能表項目樣式屬性Menu item style property 描述Description
DynamicHoverStyle 當滑鼠指標位於動態功能表項目上方時的樣式設定。The style settings for a dynamic menu item when the mouse pointer is positioned over it.
DynamicMenuItemStyle 個別動態功能表項目的樣式設定。The style settings for an individual dynamic menu item.
DynamicMenuStyle 動態功能表的樣式設定。The style settings for a dynamic menu.
DynamicSelectedStyle 目前選取之動態功能表項目的樣式設定。The style settings for the currently selected dynamic menu item.
StaticHoverStyle 當滑鼠指標位於靜態功能表項目上時,該專案的樣式設定。The style settings for a static menu item when the mouse pointer is positioned over it.
StaticMenuItemStyle 個別靜態功能表項目的樣式設定。The style settings for an individual static menu item.
StaticMenuStyle 靜態功能表的樣式設定。The style settings for a static menu.
StaticSelectedStyle 目前所選取之靜態功能表項目的樣式設定。The style settings for the currently selected static menu item.

您可以使用下列樣式集合,根據其層級來指定套用至功能表項目的樣式,而不是設定個別樣式屬性。Instead of setting the individual style properties, you can specify styles that are applied to menu items based on their level by using the following style collections.

層級樣式集合Level style collections 描述Description
LevelMenuItemStyles 物件的集合 MenuItemStyle ,可控制以層級為基礎的功能表項目樣式。A collection of MenuItemStyle objects that control the style of the menu items on a level basis.
LevelSelectedStyles 物件的集合 MenuItemStyle ,可控制以層級為基礎的所選功能表項目樣式。A collection of MenuItemStyle objects that control the style of selected menu items on a level basis.
LevelSubMenuStyles 物件的集合 MenuItemStyle ,可控制以層級為基礎的子功能表專案樣式。A collection of MenuItemStyle objects that control the style of the submenu items on a level basis.

集合中的第一個樣式會對應至功能表樹狀結構中第一個深度層級的功能表項目樣式。The first style in the collection corresponds to the style of the menu items at the first depth level in the menu tree. 集合中的第二個樣式會對應至功能表樹狀結構中第二個深度層級的功能表項目樣式,依此類推。The second style in the collection corresponds to the style of the menu items at the second depth level in the menu tree, and so on. 這最常用來產生目錄樣式的導覽功能表,其中特定深度的功能表項目應該具有相同的外觀,不論它們是否有子功能表。This is most often used to generate table of contents-style navigation menus where menu items at a certain depth should have the same appearance, regardless of whether they have submenus.

注意

如果您使用上表所列的任何層級樣式集合來定義控制項的樣式,則 Menu 這些樣式設定會覆寫個別的功能表項目樣式屬性。If you use any of the level style collections listed in the previous table to define the style for the Menu control, these style settings override the individual menu item style properties.

改變控制面板的另一種方式,就是自訂控制項中顯示的影像 MenuAnother way to alter the appearance of the control is to customize the images displayed in the Menu control. 您可以藉由設定下表所示的屬性,為控制項的不同部分指定您自己的自訂影像。You can specify your own custom image for the different parts of the control by setting the properties shown in the following table.

Image 屬性Image property 描述Description
DynamicBottomSeparatorImageUrl 顯示在動態功能表項目底部的選擇性影像,用來將它與其他功能表項目隔開。An optional image displayed at the bottom of a dynamic menu item to separate it from other menu items.
DynamicPopOutImageUrl 顯示在動態功能表項目中的選擇性影像,表示它有子功能表。An optional image displayed in a dynamic menu item to indicate that it has a submenu.
DynamicTopSeparatorImageUrl 顯示在動態功能表項目頂端的選擇性影像,用來將它與其他功能表項目隔開。An optional image displayed at the top of a dynamic menu item to separate it from other menu items.
ScrollDownImageUrl 顯示在功能表項目底部的影像,表示使用者可以向下滾動以查看其他功能表項目。The image displayed at the bottom of a menu item to indicate that the user can scroll down to view additional menu items.
ScrollUpImageUrl 顯示在功能表項目頂端的影像,表示使用者可以向上滾動以查看其他功能表項目。The image displayed at the top of a menu item to indicate that the user can scroll up to view additional menu items.
StaticBottomSeparatorImageUrl 顯示在靜態功能表項目底部的選擇性影像,可將它與其他功能表項目隔開。An optional image displayed at the bottom of a static menu item to separate it from other menu items.
StaticPopOutImageUrl 顯示在靜態功能表項目中的選擇性影像,表示它有子功能表。An optional image displayed in a static menu item to indicate that it has a submenu.
StaticTopSeparatorImageUrl 在靜態功能表項目頂端顯示的選擇性影像,用來將它與其他功能表項目隔開。An optional image displayed at the top of a static menu item to separate it from other menu items.

如需使用者介面 (UI) 的完整控制,您可以 Menu 使用下列範本屬性,為控制項定義您自己的自訂範本。For complete control of the user interface (UI), you can define your own custom templates for the Menu control using the following template properties.

Template 屬性Template property 描述Description
DynamicItemTemplate 包含要針對動態功能表項目呈現之自訂內容的範本。The template that contains the custom content to render for a dynamic menu item.
StaticItemTemplate 包含要針對靜態功能表項目呈現之自訂內容的範本。The template that contains the custom content to render for a static menu item.

您可以 DynamicVerticalOffset 分別設定和屬性,以控制相對於其父功能表項目之動態功能表的垂直和水準位置 DynamicHorizontalOffsetYou can control the vertical and horizontal position of a dynamic menu relative to its parent menu item by setting the DynamicVerticalOffset and DynamicHorizontalOffset properties, respectively. 若要控制靜態功能表中靜態子功能表專案的縮排,請使用 StaticSubMenuIndent 屬性。To control the indentation of the static submenu items within a static menu, use the StaticSubMenuIndent property.

事件Events

Menu控制項提供幾個您可以針對進行程式設計的事件。The Menu control provides several events that you can program against. 這可讓您在每次發生事件時執行自訂常式。This allows you to run a custom routine whenever an event occurs. 下表列出支援的事件。The following table lists the supported events.

事件Event 描述Description
MenuItemClick 按一下功能表項目時發生。Occurs when a menu item is clicked. 這個事件通常用來同步處理 Menu 控制項與頁面上的另一個控制項。This event is commonly used to synchronize a Menu control with another control on the page.
MenuItemDataBound 當功能表項目系結至資料時發生。Occurs when a menu item is bound to data. 這個事件通常用來修改功能表項目,然後在控制項中呈現它 MenuThis event is commonly used to modify a menu item before it is rendered in a Menu control.

協助工具選項Accessibility

如需如何設定此控制項,使其產生符合協助工具標準之標記的詳細資訊,請參閱Visual Studio 和 ASP.NETASP.NET 控制項和協助工具中的協助工具。For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio and ASP.NET and ASP.NET Controls and Accessibility.

宣告式語法Declarative Syntax

<asp:Menu  
    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"  
    DataSource="string"  
    DataSourceID="string"  
    DisappearAfter="integer"  
    DynamicBottomSeparatorImageUrl="uri"  
    DynamicEnableDefaultPopOutImage="True|False"  
    DynamicHorizontalOffset="integer"  
    DynamicItemFormatString="string"  
    DynamicPopOutImageTextFormatString="string"  
    DynamicPopOutImageUrl="uri"  
    DynamicTopSeparatorImageUrl="uri"  
    DynamicVerticalOffset="integer"  
    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"  
    ItemWrap="True|False"  
    MaximumDynamicDisplayLevels="integer"  
    OnDataBinding="DataBinding event handler"  
    OnDataBound="DataBound event handler"  
    OnDisposed="Disposed event handler"  
    OnInit="Init event handler"  
    OnLoad="Load event handler"  
    OnMenuItemClick="MenuItemClick event handler"  
    OnMenuItemDataBound="MenuItemDataBound event handler"  
    OnPreRender="PreRender event handler"  
    OnUnload="Unload event handler"  
    Orientation="Horizontal|Vertical"  
    PathSeparator="string"  
    runat="server"  
    ScrollDownImageUrl="uri"  
    ScrollDownText="string"  
    ScrollUpImageUrl="uri"  
    ScrollUpText="string"  
    SkinID="string"  
    SkipLinkText="string"  
    StaticBottomSeparatorImageUrl="uri"  
    StaticDisplayLevels="integer"  
    StaticEnableDefaultPopOutImage="True|False"  
    StaticItemFormatString="string"  
    StaticPopOutImageTextFormatString="string"  
    StaticPopOutImageUrl="uri"  
    StaticSubMenuIndent="size"  
    StaticTopSeparatorImageUrl="uri"  
    Style="string"  
    TabIndex="integer"  
    Target="string"  
    ToolTip="string"  
    Visible="True|False"  
    Width="size"  
>  
        <DataBindings>  
                <asp:MenuItemBinding  
                    DataMember="string"  
                    Depth="integer"  
                    Enabled="True|False"  
                    EnabledField="string"  
                    FormatString="string"  
                    ImageUrl="uri"  
                    ImageUrlField="string"  
                    NavigateUrl="uri"  
                    NavigateUrlField="string"  
                    PopOutImageUrl="uri"  
                    PopOutImageUrlField="string"  
                    Selectable="True|False"  
                    SelectableField="string"  
                    SeparatorImageUrl="uri"  
                    SeparatorImageUrlField="string"  
                    Target="string"  
                    TargetField="string"  
                    Text="string"  
                    TextField="string"  
                    ToolTip="string"  
                    ToolTipField="string"  
                    Value="string"  
                    ValueField="string"  
                />  
        </DataBindings>  
        <DynamicHoverStyle />  
        <DynamicItemTemplate>  
            <!-- child controls -->  
        </DynamicItemTemplate>  
        <DynamicMenuItemStyle  
            BackColor="color name|#dddddd"  
            BorderColor="color name|#dddddd"  
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|  
                Groove|Ridge|Inset|Outset"  
            BorderWidth="size"  
            CssClass="string"  
            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"  
            HorizontalPadding="size"  
            ItemSpacing="size"  
            OnDisposed="Disposed event handler"  
            VerticalPadding="size"  
            Width="size"  
        />  
        <DynamicMenuStyle  
            BackColor="color name|#dddddd"  
            BorderColor="color name|#dddddd"  
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|  
                Groove|Ridge|Inset|Outset"  
            BorderWidth="size"  
            CssClass="string"  
            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"  
            HorizontalPadding="size"  
            OnDisposed="Disposed event handler"  
            VerticalPadding="size"  
            Width="size"  
        />  
        <DynamicSelectedStyle  
            BackColor="color name|#dddddd"  
            BorderColor="color name|#dddddd"  
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|  
                Groove|Ridge|Inset|Outset"  
            BorderWidth="size"  
            CssClass="string"  
            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"  
            HorizontalPadding="size"  
            ItemSpacing="size"  
            OnDisposed="Disposed event handler"  
            VerticalPadding="size"  
            Width="size"  
        />  
        <Items />  
        <LevelMenuItemStyles>  
                <asp:MenuItemStyle  
                    BackColor="color name|#dddddd"  
                    BorderColor="color name|#dddddd"  
                    BorderStyle="NotSet|None|Dotted|Dashed|Solid|  
                        Double|Groove|Ridge|Inset|Outset"  
                    BorderWidth="size"  
                    CssClass="string"  
                    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"  
                    HorizontalPadding="size"  
                    ItemSpacing="size"  
                    OnDisposed="Disposed event handler"  
                    VerticalPadding="size"  
                    Width="size"  
                />  
        </LevelMenuItemStyles>  
        <LevelSelectedStyles>  
                <asp:MenuItemStyle  
                    BackColor="color name|#dddddd"  
                    BorderColor="color name|#dddddd"  
                    BorderStyle="NotSet|None|Dotted|Dashed|Solid|  
                        Double|Groove|Ridge|Inset|Outset"  
                    BorderWidth="size"  
                    CssClass="string"  
                    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"  
                    HorizontalPadding="size"  
                    ItemSpacing="size"  
                    OnDisposed="Disposed event handler"  
                    VerticalPadding="size"  
                    Width="size"  
                />  
        </LevelSelectedStyles>  
        <LevelSubMenuStyles>  
                <asp:SubMenuStyle  
                    BackColor="color name|#dddddd"  
                    BorderColor="color name|#dddddd"  
                    BorderStyle="NotSet|None|Dotted|Dashed|Solid|  
                        Double|Groove|Ridge|Inset|Outset"  
                    BorderWidth="size"  
                    CssClass="string"  
                    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"  
                    HorizontalPadding="size"  
                    OnDisposed="Disposed event handler"  
                    VerticalPadding="size"  
                    Width="size"  
                />  
        </LevelSubMenuStyles>  
        <StaticHoverStyle />  
        <StaticItemTemplate>  
            <!-- child controls -->  
        </StaticItemTemplate>  
        <StaticMenuItemStyle  
            BackColor="color name|#dddddd"  
            BorderColor="color name|#dddddd"  
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|  
                Groove|Ridge|Inset|Outset"  
            BorderWidth="size"  
            CssClass="string"  
            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"  
            HorizontalPadding="size"  
            ItemSpacing="size"  
            OnDisposed="Disposed event handler"  
            VerticalPadding="size"  
            Width="size"  
        />  
        <StaticMenuStyle  
            BackColor="color name|#dddddd"  
            BorderColor="color name|#dddddd"  
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|  
                Groove|Ridge|Inset|Outset"  
            BorderWidth="size"  
            CssClass="string"  
            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"  
            HorizontalPadding="size"  
            OnDisposed="Disposed event handler"  
            VerticalPadding="size"  
            Width="size"  
        />  
        <StaticSelectedStyle  
            BackColor="color name|#dddddd"  
            BorderColor="color name|#dddddd"  
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|  
                Groove|Ridge|Inset|Outset"  
            BorderWidth="size"  
            CssClass="string"  
            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"  
            HorizontalPadding="size"  
            ItemSpacing="size"  
            OnDisposed="Disposed event handler"  
            VerticalPadding="size"  
            Width="size"  
        />  
</asp:Menu>  

建構函式

Menu()

初始化 Menu 類別的新執行個體。Initializes a new instance of the Menu class.

欄位

MenuItemClickCommandName

包含命令名稱。Contains the command name.

屬性

AccessKey

取得或設定便捷鍵 (Access Key),可讓您快速巡覽至 Web 伺服器控制項。Gets or sets the access key that allows you to quickly navigate to the Web server control.

(繼承來源 WebControl)
Adapter

針對控制項取得瀏覽器的特定配置器。Gets the browser-specific adapter for the control.

(繼承來源 Control)
AppRelativeTemplateSourceDirectory

取得或設定包含了此控制項之 PageUserControl 物件的相對應用程式虛擬目錄。Gets or sets the application-relative virtual directory of the Page or UserControl object that contains this control.

(繼承來源 Control)
Attributes

取得任意屬性 (Attribute) 的集合 (只供呈現),不與控制項上的屬性 (Property) 對應。Gets the collection of arbitrary attributes (for rendering only) that do not correspond to properties on the control.

(繼承來源 WebControl)
BackColor

取得或設定 Web 伺服器控制項的背景色彩。Gets or sets the background color of the Web server control.

(繼承來源 WebControl)
BindingContainer

取得包含了此控制項之資料繫結的控制項。Gets the control that contains this control's data binding.

(繼承來源 Control)
BorderColor

取得或設定 Web 控制項的框線色彩。Gets or sets the border color of the Web control.

(繼承來源 WebControl)
BorderStyle

取得或設定 Web 伺服器控制項的框線樣式。Gets or sets the border style of the Web server control.

(繼承來源 WebControl)
BorderWidth

取得或設定 Web 伺服器控制項的框線寬度。Gets or sets the border width of the Web server control.

(繼承來源 WebControl)
ChildControlsCreated

取得值,指出是否已經建立伺服器控制項的子控制項。Gets a value that indicates whether the server control's child controls have been created.

(繼承來源 Control)
ClientID

取得 ASP.NET 所產生之 HTML 標記的控制項識別碼。Gets the control ID for HTML markup that is generated by ASP.NET.

(繼承來源 Control)
ClientIDMode

取得或設定用來產生 ClientID 屬性值的演算法。Gets or sets the algorithm that is used to generate the value of the ClientID property.

(繼承來源 Control)
ClientIDSeparator

取得字元值,表示在 ClientID 屬性中所使用的分隔字元。Gets a character value representing the separator character used in the ClientID property.

(繼承來源 Control)
Context

取得與目前 Web 要求的伺服器控制項關聯的 HttpContext 物件。Gets the HttpContext object associated with the server control for the current Web request.

(繼承來源 Control)
Controls

取得 ControlCollection,其中包含 Menu 控制項的子控制項。Gets a ControlCollection that contains the child controls of the Menu control.

ControlStyle

取得 Web 伺服器控制項的樣式。Gets the style of the Web server control. 這個屬性主要由控制項開發人員使用。This property is used primarily by control developers.

(繼承來源 WebControl)
ControlStyleCreated

取得值,指出 Style 物件是否已經為 ControlStyle 屬性建立。Gets a value indicating whether a Style object has been created for the ControlStyle property. 這個屬性主要由控制項開發人員使用。This property is primarily used by control developers.

(繼承來源 WebControl)
CssClass

取得或設定用戶端上 Web 伺服器控制項所呈現的階層式樣式表 (CSS)。Gets or sets the Cascading Style Sheet (CSS) class rendered by the Web server control on the client.

(繼承來源 WebControl)
DataBindings

取得 MenuItemBinding 物件的集合,這些物件會定義資料項目及它所繫結之功能表項目之間的關係。Gets a collection of MenuItemBinding objects that define the relationship between a data item and the menu item it is binding to.

DataItemContainer

如果命名容器實作 IDataItemContainer,則取得命名容器的參考。Gets a reference to the naming container if the naming container implements IDataItemContainer.

(繼承來源 Control)
DataKeysContainer

如果命名容器實作 IDataKeysControl,則取得命名容器的參考。Gets a reference to the naming container if the naming container implements IDataKeysControl.

(繼承來源 Control)
DataSource

取得或設定資料繫結控制項從中擷取其資料項目清單的物件。Gets or sets the object from which the data-bound control retrieves its list of data items.

(繼承來源 BaseDataBoundControl)
DataSourceID

取得或設定控制項的識別碼,資料繫結控制項會由此擷取其項目清單。Gets or sets the ID of the control from which the data-bound control retrieves its list of data items.

(繼承來源 HierarchicalDataBoundControl)
DesignMode

取得值,指出控制項是否正用於設計介面上。Gets a value indicating whether a control is being used on a design surface.

(繼承來源 Control)
DisappearAfter

取得或設定當滑鼠指標不再位於功能表上之後,動態功能表顯示的持續期間。Gets or sets the duration for which a dynamic menu is displayed after the mouse pointer is no longer positioned over the menu.

DynamicBottomSeparatorImageUrl

取得或設定顯示在每個動態功能表項目底部,以便與其他功能表項目隔開之影像的 URL。Gets or sets the URL to an image to display at the bottom of each dynamic menu item to separate it from other menu items.

DynamicEnableDefaultPopOutImage

取得或設定值,指出是否顯示表示動態功能表項目具有子功能表的內建影像。Gets or sets a value indicating whether the built-in image that indicates that a dynamic menu item has a submenu is displayed.

DynamicHorizontalOffset

取得或設定讓動態功能表相對於其父功能表項目進行水平移位的像素數。Gets or sets the number of pixels to shift a dynamic menu horizontally relative to its parent menu item.

DynamicHoverStyle

取得 Style 物件的參考,這個物件可讓您設定當滑鼠指標位於動態功能表項目上時,動態功能表項目的外觀。Gets a reference to the Style object that allows you to set the appearance of a dynamic menu item when the mouse pointer is positioned over it.

DynamicItemFormatString

取得或設定與動態顯示之所有功能表項目一起顯示的其他文字。Gets or sets additional text shown with all menu items that are dynamically displayed.

DynamicItemTemplate

取得或設定樣板,含有針對動態功能表項目呈現的自訂內容。Gets or sets the template that contains the custom content to render for a dynamic menu.

DynamicMenuItemStyle

取得 MenuItemStyle 物件的參考,這個物件可以讓您設定動態功能表中功能表項目的外觀。Gets a reference to the MenuItemStyle object that allows you to set the appearance of the menu items within a dynamic menu.

DynamicMenuStyle

取得 MenuItemStyle 物件的參考,這個物件可讓您設定動態功能表的外觀。Gets a reference to the MenuItemStyle object that allows you to set the appearance of a dynamic menu.

DynamicPopOutImageTextFormatString

取得或設定用來表示動態功能表項目具有子功能表之影像的替代文字。Gets or sets the alternate text for the image used to indicate that a dynamic menu item has a submenu.

DynamicPopOutImageUrl

取得或設定當動態功能表項目具有子功能表時,顯示在動態功能表項目中的自訂影像 URL。Gets or sets the URL to a custom image that is displayed in a dynamic menu item when the dynamic menu item has a submenu.

DynamicSelectedStyle

取得 MenuItemStyle 物件的參考,這個物件可讓您設定使用者選取之動態功能表項目的外觀。Gets a reference to the MenuItemStyle object that allows you to set the appearance of the dynamic menu item selected by the user.

DynamicTopSeparatorImageUrl

取得或設定顯示在每個動態功能表項目頂端,以便與其他功能表項目隔開之影像的 URL。Gets or sets the URL to an image to display at the top of each dynamic menu item to separate it from other menu items.

DynamicVerticalOffset

取得或設定讓動態功能表相對於其父功能表項目進行垂直移位的像素數。Gets or sets the number of pixels to shift a dynamic menu vertically relative to its parent menu item.

Enabled

取得或設定值,指出 Web 伺服器控制項是否啟用。Gets or sets a value indicating whether the Web server control is enabled.

(繼承來源 WebControl)
EnableTheming

取得或設定值,指出佈景主題是否套用至此控制項。Gets or sets a value indicating whether themes apply to this control.

(繼承來源 WebControl)
EnableViewState

取得或設定值,該值表示伺服器控制項是否對要求的用戶端而言保持其檢視狀態,以及它包含的任何子控制項狀態。Gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client.

(繼承來源 Control)
Events

取得控制項事件處理常式委派 (Delegate) 的清單。Gets a list of event handler delegates for the control. 這個屬性是唯讀的。This property is read-only.

(繼承來源 Control)
Font

取得與 Web 伺服器控制項關聯的字型屬性。Gets the font properties associated with the Web server control.

(繼承來源 WebControl)
ForeColor

取得或設定 Web 伺服器控制項的前景色彩 (通常是文字的色彩)。Gets or sets the foreground color (typically the color of the text) of the Web server control.

(繼承來源 WebControl)
HasAttributes

取得值,指出控制項是否已經設定屬性。Gets a value indicating whether the control has attributes set.

(繼承來源 WebControl)
HasChildViewState

取得值,指出目前伺服器控制項的子控制項是否有任何已儲存的檢視狀態設定。Gets a value indicating whether the current server control's child controls have any saved view-state settings.

(繼承來源 Control)
Height

取得或設定 Web 伺服器控制項的高度。Gets or sets the height of the Web server control.

(繼承來源 WebControl)
ID

取得或設定指派給伺服器控制項的程式設計識別項。Gets or sets the programmatic identifier assigned to the server control.

(繼承來源 Control)
IdSeparator

取得用來分隔控制項識別項的字元。Gets the character used to separate control identifiers.

(繼承來源 Control)
IncludeStyleBlock

取得或設定值,這個值表示 ASP.NET 是否應該針對功能表中使用的樣式,在階層式樣式表 (CSS) 定義中專門設立一個區塊。Gets or sets a value that indicates whether ASP.NET should render a block of cascading style sheet (CSS) definitions for the styles that are used in the menu.

Initialized

取得值,指出是否已初始化資料繫結控制項。Gets a value indicating whether the data-bound control has been initialized.

(繼承來源 BaseDataBoundControl)
IsBoundUsingDataSourceID

取得值,指出是否已設定 DataSourceID 屬性。Gets a value indicating whether the DataSourceID property is set.

(繼承來源 BaseDataBoundControl)
IsChildControlStateCleared

取得值,指出這個控制項中所包含的控制項是否有控制項狀態。Gets a value indicating whether controls contained within this control have control state.

(繼承來源 Control)
IsDataBindingAutomatic

取得值,指出資料繫結是否為自動。Gets a value that indicates whether data binding is automatic.

(繼承來源 BaseDataBoundControl)
IsEnabled

取得值,指出是否啟用控制項。Gets a value indicating whether the control is enabled.

(繼承來源 WebControl)
IsTrackingViewState

取得值,指出伺服器控制項是否正在儲存檢視狀態的變更。Gets a value that indicates whether the server control is saving changes to its view state.

(繼承來源 Control)
IsUsingModelBinders

在衍生類別中實作時,取得值,此值指出控制項是否正使用模型繫結器。When implemented in a derived class, gets a value that indicates whether the control is using model binders.

(繼承來源 BaseDataBoundControl)
IsViewStateEnabled

取得值,指出這個控制項是否已啟用檢視狀態。Gets a value indicating whether view state is enabled for this control.

(繼承來源 Control)
Items

取得 MenuItemCollection 物件,這個物件含有 Menu 控制項中所有的功能表項目。Gets a MenuItemCollection object that contains all menu items in the Menu control.

ItemWrap

取得或設定值,表示功能表項目的文字是否應換行。Gets or sets a value indicating whether the text for menu items should wrap.

LevelMenuItemStyles

取得 MenuItemStyleCollection 物件,這個物件含有根據 Menu 控制項中的功能表項目層級,套用至功能表項目的樣式設定。Gets a MenuItemStyleCollection object that contains the style settings that are applied to menu items based on their level in a Menu control.

LevelSelectedStyles

取得 MenuItemStyleCollection 物件,這個物件含有根據 Menu 控制項中的功能表項目層級,套用至選取功能表項目的樣式設定。Gets a MenuItemStyleCollection object that contains the style settings that are applied to the selected menu item based on its level in a Menu control.

LevelSubMenuStyles

取得 MenuItemStyleCollection 物件,這個物件含有根據 Menu 控制項中的子功能表項目層級,套用至靜態功能表中子功能表項目的樣式設定。Gets a MenuItemStyleCollection object that contains the style settings that are applied to the submenu items in the static menu based on their level in a Menu control.

LoadViewStateByID

取得值,指出控制項是否依 ID (而不是索引) 參與載入其檢視狀態。Gets a value indicating whether the control participates in loading its view state by ID instead of index.

(繼承來源 Control)
MaximumDynamicDisplayLevels

取得或設定要針對動態功能表呈現的功能表層級數目。Gets or sets the number of menu levels to render for a dynamic menu.

NamingContainer

取得伺服器控制項命名容器的參考,其建立唯一命名空間,在具有相同 ID 屬性值的伺服器控制項之間作區別。Gets a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same ID property value.

(繼承來源 Control)
Orientation

取得或設定 Menu 控制項的呈現方向。Gets or sets the direction in which to render the Menu control.

Page

取得含有伺服器控制項的 Page 執行個體的參考。Gets a reference to the Page instance that contains the server control.

(繼承來源 Control)
Parent

在網頁控制階層架構中取得伺服器控制項之父控制項的參考。Gets a reference to the server control's parent control in the page control hierarchy.

(繼承來源 Control)
PathSeparator

取得或設定字元,用來分隔 Menu 控制項中功能表項目的路徑。Gets or sets the character used to delimit the path of a menu item in a Menu control.

RenderingCompatibility

取得值,這個值會指定將與呈現 HTML 相容的 ASP.NET 版本。Gets a value that specifies the ASP.NET version that rendered HTML will be compatible with.

(繼承來源 Control)
RenderingMode

取得或設定值,這個值指定 Menu 控制項會呈現 HTML table 項目和內嵌樣式,還是會呈現 listitem 項目和階層式樣式表 (CSS) 樣式。Gets or sets a value that specifies whether the Menu control renders HTML table elements and inline styles, or listitem elements and cascading style sheet (CSS) styles.

RequiresDataBinding

取得或設定值,指出是否應該呼叫 DataBind() 方法。Gets or sets a value indicating whether the DataBind() method should be called.

(繼承來源 BaseDataBoundControl)
ScrollDownImageUrl

取得或設定顯示在動態功能表中之影像的 URL,表示使用者可以向下捲動以檢視其他功能表項目。Gets or sets the URL to an image displayed in a dynamic menu to indicate that the user can scroll down for additional menu items.

ScrollDownText

取得或設定 ScrollDownImageUrl 屬性中所指定影像的替代文字。Gets or sets the alternate text for the image specified in the ScrollDownImageUrl property.

ScrollUpImageUrl

取得或設定顯示在動態功能表中之影像的 URL,表示使用者可以向上捲動以檢視其他功能表項目。Gets or sets the URL to an image displayed in a dynamic menu to indicate that the user can scroll up for additional menu items.

ScrollUpText

取得或設定 ScrollUpImageUrl 屬性中所指定影像的替代文字。Gets or sets the alternate text for the image specified in the ScrollUpImageUrl property.

SelectedItem

取得選取的功能表項目。Gets the selected menu item.

SelectedValue

取得選取功能表項目的值。Gets the value of the selected menu item.

Site

當呈現在設計介面上時,取得裝載目前控制項之容器的資訊。Gets information about the container that hosts the current control when rendered on a design surface.

(繼承來源 Control)
SkinID

取得或設定要套用至控制項的面板。Gets or sets the skin to apply to the control.

(繼承來源 WebControl)
SkipLinkText

取得或設定隱藏影像的替代文字,讓螢幕助讀程式讀取以提供略過連結清單的能力。Gets or sets the alternate text for a hidden image read by screen readers to provide the ability to skip the list of links.

StaticBottomSeparatorImageUrl

取得或設定顯示在每個靜態功能表項目底部,做為分隔符號之影像的 URL。Gets or sets the URL to an image displayed as the separator at the bottom of each static menu item.

StaticDisplayLevels

取得或設定要在靜態功能表中顯示的功能表層級數目。Gets or sets the number of menu levels to display in a static menu.

StaticEnableDefaultPopOutImage

取得或設定值,表示是否顯示內建影像以表示靜態功能表項目具有子功能表。Gets or sets a value indicating whether the built-in image is displayed to indicate that a static menu item has a submenu.

StaticHoverStyle

取得 Style 物件的參考,這個物件可讓您設定當滑鼠指標位於靜態功能表項目上時,靜態功能表項目的外觀。Gets a reference to the Style object that allows you to set the appearance of a static menu item when the mouse pointer is positioned over it.

StaticItemFormatString

取得或設定與靜態顯示之所有功能表項目一起顯示的其他文字。Gets or sets additional text shown with all menu items that are statically displayed.

StaticItemTemplate

取得或設定樣板,含有針對靜態功能表項目呈現的自訂內容。Gets or sets the template that contains the custom content to render for a static menu.

StaticMenuItemStyle

取得 MenuItemStyle 物件的參考,這個物件可以讓您設定靜態功能表中功能表項目的外觀。Gets a reference to the MenuItemStyle object that allows you to set the appearance of the menu items in a static menu.

StaticMenuStyle

取得 MenuItemStyle 物件的參考,這個物件可讓您設定動態功能表的外觀。Gets a reference to the MenuItemStyle object that allows you to set the appearance of a static menu.

StaticPopOutImageTextFormatString

取得或設定用來表示靜態功能表項目具有子功能表之快顯影像的替代文字。Gets or sets the alternate text for the pop-out image used to indicate that a static menu item has a submenu.

StaticPopOutImageUrl

取得或設定顯示來表示靜態功能表項目具有子功能表之影像的 URL。Gets or sets the URL to an image displayed to indicate that a static menu item has a submenu.

StaticSelectedStyle

取得 MenuItemStyle 物件的參考,這個物件可以讓您設定使用者在靜態功能表中選取之功能表項目的外觀。Gets a reference to the MenuItemStyle object that allows you to set the appearance of the menu item selected by the user in a static menu.

StaticSubMenuIndent

取得或設定要讓子功能表在靜態功能表內縮排的間距 (以像素為單位)。Gets or sets the amount of space, in pixels, to indent submenus within a static menu.

StaticTopSeparatorImageUrl

取得或設定顯示在每個靜態功能表項目頂端,做為分隔符號之影像的 URL。Gets or sets the URL to an image displayed as the separator at the top of each static menu item.

Style

取得文字屬性的集合,將呈現為 Web 伺服器控制項的外部標記上的樣式屬性。Gets a collection of text attributes that will be rendered as a style attribute on the outer tag of the Web server control.

(繼承來源 WebControl)
SupportsDisabledAttribute

取得值,這個值表示當控制項的 disabled 屬性為 IsEnabled 時,控制項是否應該將呈現之 HTML 項目的 false 屬性設為 "disabled"。Gets a value that indicates whether the control should set the disabled attribute of the rendered HTML element to "disabled" when the control's IsEnabled property is false.

(繼承來源 BaseDataBoundControl)
TabIndex

取得或設定 Web 伺服器控制項的定位索引。Gets or sets the tab index of the Web server control.

(繼承來源 WebControl)
TagKey

取得對應於 HtmlTextWriterTag 控制項的 Menu 值。Gets the HtmlTextWriterTag value that corresponds to a Menu control. 這個屬性主要由控制項開發人員使用。This property is used primarily by control developers.

TagName

取得控制項標記的名稱。Gets the name of the control tag. 這個屬性主要由控制項開發人員使用。This property is used primarily by control developers.

(繼承來源 WebControl)
Target

取得或設定要顯示與功能表項目關聯之 Web 網頁內容的目標視窗或框架。Gets or sets the target window or frame in which to display the Web page content associated with a menu item.

TemplateControl

取得或設定包含了此控制項之樣板的參考。Gets or sets a reference to the template that contains this control.

(繼承來源 Control)
TemplateSourceDirectory

取得包含目前伺服器控制項的 PageUserControl 的虛擬目錄。Gets the virtual directory of the Page or UserControl that contains the current server control.

(繼承來源 Control)
ToolTip

取得或設定當滑鼠指標停留在 Web 伺服器控制項時顯示的文字。Gets or sets the text displayed when the mouse pointer hovers over the Web server control.

(繼承來源 WebControl)
UniqueID

取得伺服器控制項唯一的、符合階層架構的識別項。Gets the unique, hierarchically qualified identifier for the server control.

(繼承來源 Control)
ValidateRequestMode

取得或設定值,指出控制項是否對來自瀏覽器的用戶端輸入檢查潛在的危險值。Gets or sets a value that indicates whether the control checks client input from the browser for potentially dangerous values.

(繼承來源 Control)
ViewState

取得狀態資訊的字典,允許您在相同網頁的多個要求之間,儲存和還原伺服器控制項的檢視狀態。Gets a dictionary of state information that allows you to save and restore the view state of a server control across multiple requests for the same page.

(繼承來源 Control)
ViewStateIgnoresCase

取得值,指出 StateBag 物件是否不區分大小寫。Gets a value that indicates whether the StateBag object is case-insensitive.

(繼承來源 Control)
ViewStateMode

取得或設定這個控制項的檢視狀態模式。Gets or sets the view-state mode of this control.

(繼承來源 Control)
Visible

取得或設定值,指出伺服器控制項是否會轉譯為頁面上的 UI。Gets or sets a value that indicates whether a server control is rendered as UI on the page.

(繼承來源 Control)
Width

取得或設定 Web 伺服器控制項的寬度。Gets or sets the width of the Web server control.

(繼承來源 WebControl)

方法

AddAttributesToRender(HtmlTextWriter)

將需要呈現的 HTML 屬性和樣式加入指定的 HtmlTextWriter 物件中。Adds HTML attributes and styles that need to be rendered to the specified HtmlTextWriter object.

AddedControl(Control, Int32)

在子控制項加入 Control 物件的 Controls 集合後呼叫。Called after a child control is added to the Controls collection of the Control object.

(繼承來源 Control)
AddParsedSubObject(Object)

通知伺服器控制項,XML 或 HTML 項目已剖析,並將項目加入伺服器控制項的 ControlCollection 物件中。Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object.

(繼承來源 Control)
ApplyStyle(Style)

將指定樣式的任何非空白項目加入到 Web 控制項中,覆寫控制項的任何現有的樣式項目。Copies any nonblank elements of the specified style to the Web control, overwriting any existing style elements of the control. 這個方法主要由控制項開發人員使用。This method is primarily used by control developers.

(繼承來源 WebControl)
ApplyStyleSheetSkin(Page)

將頁面樣式表中所定義的樣式屬性套用至控制項。Applies the style properties defined in the page style sheet to the control.

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

開始進行轉譯資料的設計階段追蹤。Begins design-time tracing of rendering data.

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

收集伺服器控制項的相關資訊,並在頁面啟用追蹤時將此資訊傳遞至 Trace 屬性以顯示之。Gathers information about the server control and delivers it to the Trace property to be displayed when tracing is enabled for the page.

(繼承來源 Control)
ClearCachedClientID()

將快取的 ClientID 值設定為 nullSets the cached ClientID value to null.

(繼承來源 Control)
ClearChildControlState()

刪除伺服器控制項之子控制項的控制項狀態資訊。Deletes the control-state information for the server control's child controls.

(繼承來源 Control)
ClearChildState()

刪除所有伺服器控制項之子控制項的檢視狀態和控制項狀態資訊。Deletes the view-state and control-state information for all the server control's child controls.

(繼承來源 Control)
ClearChildViewState()

刪除所有伺服器控制項之子控制項的檢視狀態資訊。Deletes the view-state information for all the server control's child controls.

(繼承來源 Control)
ClearEffectiveClientIDMode()

將目前的控制項執行個體和任何子控制項的 ClientIDMode 屬性設定為 InheritSets the ClientIDMode property of the current control instance and of any child controls to Inherit.

(繼承來源 Control)
ConfirmInitState()

設定資料繫結控制項之初始化的狀態。Sets the initialized state of the data-bound control.

(繼承來源 BaseDataBoundControl)
CopyBaseAttributes(WebControl)

將不被 Style 物件封裝的屬性從指定的 Web 伺服器控制項複製到呼叫這個方法的 Web 伺服器控制項上。Copies the properties not encapsulated by the Style object from the specified Web server control to the Web server control that this method is called from. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

(繼承來源 WebControl)
CreateChildControls()

建立 Menu 控制項的子控制項。Creates the child controls of a Menu control.

CreateControlCollection()

建立新的 ControlCollection 物件來保存伺服器控制項的子控制項 (常值和伺服器)。Creates a new ControlCollection object to hold the child controls (both literal and server) of the server control.

(繼承來源 Control)
CreateControlStyle()

建立樣式物件,這個物件被 WebControl 類別內部使用,以實作所有的樣式相關屬性。Creates the style object that is used internally by the WebControl class to implement all style related properties. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

(繼承來源 WebControl)
DataBind()

將資料來源繫結至 Menu 控制項。Binds the data source to the Menu control. 這個方法無法被繼承。This method cannot be inherited.

DataBind(Boolean)

使用會引發 DataBinding 事件的選項,繫結資料來源至叫用的伺服器控制項及其所有子控制項。Binds a data source to the invoked server control and all its child controls with an option to raise the DataBinding event.

(繼承來源 Control)
DataBindChildren()

繫結資料來源至伺服器控制項的子控制項。Binds a data source to the server control's child controls.

(繼承來源 Control)
Dispose()

啟用伺服器控制項,在它從記憶體釋放之前執行最後清除。Enables a server control to perform final clean up before it is released from memory.

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

結束轉譯資料的設計階段追蹤。Ends design-time tracing of rendering data.

(繼承來源 Control)
EnsureChildControls()

判斷伺服器控制項是否包含子控制項。Determines whether the server control contains child controls. 如果不包含,則建立子控制項。If it does not, it creates child controls.

(繼承來源 Control)
EnsureDataBound()

呼叫 DataBind() 方法之前,請先確認功能表控制項是否需要資料繫結,而且是否已指定有效的資料來源控制項。Verifies that the menu control requires data binding and that a valid data source control is specified before calling the DataBind() method.

EnsureID()

為尚未指定識別項的控制項,建立識別項。Creates an identifier for controls that do not have an identifier assigned.

(繼承來源 Control)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
FindControl(String)

在目前命名容器搜尋具有指定 id 參數的伺服器控制項。Searches the current naming container for a server control with the specified id parameter.

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

使用指定的 id 和有助於搜尋之 pathOffset 參數中所指定的整數,在目前的命名容器中搜尋伺服器控制項。Searches the current naming container for a server control with the specified id and an integer, specified in the pathOffset parameter, which aids in the search. 您不應該覆寫這個版本的 FindControl 方法。You should not override this version of the FindControl method.

(繼承來源 Control)
FindItem(String)

擷取位於指定值路徑的功能表項目。Retrieves the menu item at the specified value path.

Focus()

設定控制項的輸入焦點。Sets input focus to a control.

(繼承來源 Control)
GetData(String)

擷取 HierarchicalDataSourceView 物件,資料繫結控制項會用來執行資料作業。Retrieves a HierarchicalDataSourceView object that the data-bound control uses to perform data operations.

(繼承來源 HierarchicalDataBoundControl)
GetDataSource()

擷取與資料繫結控制項關聯的 IHierarchicalDataSource (如果有的話)。Retrieves the IHierarchicalDataSource that the data-bound control is associated with, if any.

(繼承來源 HierarchicalDataBoundControl)
GetDesignModeState()

擷取 Menu 控制項的設計階段狀態。Retrieves the design-time state of the Menu control.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetRouteUrl(Object)

取得會對應於一組路由參數的 URL。Gets the URL that corresponds to a set of route parameters.

(繼承來源 Control)
GetRouteUrl(RouteValueDictionary)

取得會對應於一組路由參數的 URL。Gets the URL that corresponds to a set of route parameters.

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

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。Gets the URL that corresponds to a set of route parameters and a route name.

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

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。Gets the URL that corresponds to a set of route parameters and a route name.

(繼承來源 Control)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
GetUniqueIDRelativeTo(Control)

傳回指定之控制項 UniqueID 屬性的前置部分。Returns the prefixed portion of the UniqueID property of the specified control.

(繼承來源 Control)
HasControls()

判斷伺服器控制項是否包含任何子控制項。Determines if the server control contains any child controls.

(繼承來源 Control)
HasEvents()

傳回值,指出控制項或任何子控制項的事件是否已註冊。Returns a value indicating whether events are registered for the control or any child controls.

(繼承來源 Control)
IsLiteralContent()

判斷伺服器控制項是否只儲存常值內容。Determines if the server control holds only literal content.

(繼承來源 Control)
LoadControlState(Object)

載入 Menu 控制項中需要保存的屬性狀態。Loads the state of the properties in the Menu control that need to be persisted.

LoadViewState(Object)

載入先前儲存的 Menu 控制項檢視狀態。Loads the previously saved view state of the Menu control.

MapPathSecure(String)

擷取虛擬絕對路徑或相對路徑所對應至的實體路徑。Retrieves the physical path that a virtual path, either absolute or relative, maps to.

(繼承來源 Control)
MarkAsDataBound()

將檢視狀態中的控制項狀態設為已成功繫結至資料。Sets the state of the control in view state as successfully bound to data.

(繼承來源 HierarchicalDataBoundControl)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
MergeStyle(Style)

將指定樣式的任何非空白項目複製到 Web 控制項,但不覆寫控制項的任何現有樣式項目。Copies any nonblank elements of the specified style to the Web control, but will not overwrite any existing style elements of the control. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

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

決定 Menu 控制項的事件是否要在頁面的使用者介面 (UI) 伺服器控制項階層架構中向上傳遞。Determines whether the event for the Menu control is passed up the page's user interface (UI) server control hierarchy.

OnDataBinding(EventArgs)

引發 DataBinding 事件。Raises the DataBinding event.

OnDataBound(EventArgs)

引發 DataBound 事件。Raises the DataBound event.

(繼承來源 BaseDataBoundControl)
OnDataPropertyChanged()

在其中一個基底資料來源識別屬性變更時呼叫,以將資料繫結控制項重新繫結至其資料。Called when one of the base data source identification properties is changed, to re-bind the data-bound control to its data.

(繼承來源 HierarchicalDataBoundControl)
OnDataSourceChanged(Object, EventArgs)

當資料繫結控制項使用的 IHierarchicalDataSource 執行個體引發 DataSourceChanged 事件時呼叫。Called when the IHierarchicalDataSource instance that the data-bound control works with raises the DataSourceChanged event.

(繼承來源 HierarchicalDataBoundControl)
OnInit(EventArgs)

引發 Init 事件。Raises the Init event.

OnLoad(EventArgs)

處理 Load 事件。Handles the Load event.

(繼承來源 HierarchicalDataBoundControl)
OnMenuItemClick(MenuEventArgs)

引發 MenuItemClick 事件。Raises the MenuItemClick event.

OnMenuItemDataBound(MenuEventArgs)

引發 MenuItemDataBound 事件。Raises the MenuItemDataBound event.

OnPagePreLoad(Object, EventArgs)

設定資料繫結控制項在載入控制項之前的初始化狀態。Sets the initialized state of the data-bound control before the control is loaded.

(繼承來源 HierarchicalDataBoundControl)
OnPreRender(EventArgs)

引發 PreRender 事件。Raises the PreRender event.

OnUnload(EventArgs)

引發 Unload 事件。Raises the Unload event.

(繼承來源 Control)
OpenFile(String)

取得用來讀取檔案的 StreamGets a Stream used to read a file.

(繼承來源 Control)
PerformDataBinding()

將資料來源中的項目繫結至 Menu 控制項中的功能表項目。Binds the items from the data source to the menu items in the Menu control.

PerformSelect()

從關聯的資料來源擷取資料。Retrieves data from the associated data source.

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

指派事件的任何來源和它的資訊至控制項的父控制項。Assigns any sources of the event and its information to the control's parent.

(繼承來源 Control)
RaisePostBackEvent(String)

處理當表單張貼至伺服器時引發的事件。Processes an event raised when a form is posted to the server.

RemovedControl(Control)

Control 物件的 Controls 集合中移除子控制項之後呼叫。Called after a child control is removed from the Controls collection of the Control object.

(繼承來源 Control)
Render(HtmlTextWriter)

在用戶端瀏覽器上呈現功能表控制項。Renders the menu control on the client browser.

RenderBeginTag(HtmlTextWriter)

加入標記屬性,並將控制項開頭標記 (Tag) 的標記 (Markup) 寫入至發出給瀏覽器或裝置的輸出資料流。Adds tag attributes and writes the markup for the opening tag of the control to the output stream emitted to the browser or device.

RenderChildren(HtmlTextWriter)

將伺服器控制項子系的內容輸出至提供的 HtmlTextWriter 物件,再由這個物件在用戶端上寫入要轉譯的內容。Outputs the content of a server control's children to a provided HtmlTextWriter object, which writes the content to be rendered on the client.

(繼承來源 Control)
RenderContents(HtmlTextWriter)

這個成員會覆寫 RenderContents(HtmlTextWriter)This member overrides RenderContents(HtmlTextWriter).

RenderControl(HtmlTextWriter)

將伺服器控制項內容輸出至提供的 HtmlTextWriter 物件,並在啟用追蹤時儲存控制項的追蹤資訊。Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled.

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

使用提供的 HtmlTextWriter 物件,輸出伺服器控制項內容至提供的 ControlAdapter 物件。Outputs server control content to a provided HtmlTextWriter object using a provided ControlAdapter object.

(繼承來源 Control)
RenderEndTag(HtmlTextWriter)

執行最終標記 (Markup),並將控制項的 HTML 結尾標記 (Tag) 寫入至發出給瀏覽器或裝置的輸出資料流。Performs final markup and writes the HTML closing tag of the control to the output stream emitted to the browser or device.

ResolveAdapter()

取得負責呈現指定之控制項的控制項配置器。Gets the control adapter responsible for rendering the specified control.

(繼承來源 Control)
ResolveClientUrl(String)

取得瀏覽器可使用的 URL。Gets a URL that can be used by the browser.

(繼承來源 Control)
ResolveUrl(String)

將 URL 轉換為要求用戶端可使用的 URL。Converts a URL into one that is usable on the requesting client.

(繼承來源 Control)
SaveControlState()

儲存 Menu 控制項中需要保存的屬性狀態。Saves the state of the properties in the Menu control that need to be persisted.

SaveViewState()

儲存 Menu 控制項的狀態。Saves the state of the Menu control.

SetDesignModeState(IDictionary)

設定 Menu 控制項的設計階段資料。Sets design-time data for the Menu control.

SetItemDataBound(MenuItem, Boolean)

使用指定值,設定指定 DataBound 物件的 MenuItem 屬性。Sets the DataBound property of the specified MenuItem object with the specified value.

SetItemDataItem(MenuItem, Object)

使用指定值,設定指定 DataItem 物件的 MenuItem 屬性。Sets the DataItem property of the specified MenuItem object with the specified value.

SetItemDataPath(MenuItem, String)

使用指定值,設定指定 DataPath 物件的 MenuItem 屬性。Sets the DataPath property of the specified MenuItem object with the specified value.

SetRenderMethodDelegate(RenderMethod)

指定事件處理常式委派,以呈現伺服器控制項及其內容至其父控制項。Assigns an event handler delegate to render the server control and its content into its parent control.

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

使用追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。Sets trace data for design-time tracing of rendering data, using the trace data key and the trace data value.

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

使用追蹤的物體、追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。Sets trace data for design-time tracing of rendering data, using the traced object, the trace data key, and the trace data value.

(繼承來源 Control)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
TrackViewState()

追蹤 Menu 控制項的檢視狀態變更,以便可將其儲存在該控制項的 StateBag 物件中。Tracks view-state changes to the Menu control so they can be stored in the control's StateBag object. 這個物件可透過 ViewState 屬性存取。This object is accessible through the ViewState property.

ValidateDataSource(Object)

驗證資料繫結控制項繫結至的物件是該資料繫結控制項所使用的物件。Verifies that the object a data-bound control binds to is one it can work with.

(繼承來源 HierarchicalDataBoundControl)

事件

DataBinding

發生於伺服器控制項繫結至資料來源時。Occurs when the server control binds to a data source.

(繼承來源 Control)
DataBound

在伺服器控制項繫結至資料來源之後發生。Occurs after the server control binds to a data source.

(繼承來源 BaseDataBoundControl)
Disposed

發生於伺服器控制項從記憶體釋放時,這是在要求 ASP.NET 網頁時,伺服器控制項生命週期的最後階段。Occurs when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested.

(繼承來源 Control)
Init

發生於初始化伺服器控制項時,是其生命週期中的第一個步驟。Occurs when the server control is initialized, which is the first step in its lifecycle.

(繼承來源 Control)
Load

發生於載入伺服器控制項至 Page 物件時。Occurs when the server control is loaded into the Page object.

(繼承來源 Control)
MenuItemClick

按一下 Menu 控制項中的功能表項目時發生。Occurs when a menu item in a Menu control is clicked.

MenuItemDataBound

Menu 控制項中的功能表項目繫結至資料時發生。Occurs when a menu item in a Menu control is bound to data.

PreRender

Control 物件載入之後但在呈現之前發生。Occurs after the Control object is loaded but prior to rendering.

(繼承來源 Control)
Unload

發生於伺服器控制項從記憶體卸載時。Occurs when the server control is unloaded from memory.

(繼承來源 Control)

明確介面實作

IAttributeAccessor.GetAttribute(String)

使用指定的名稱,取得 Web 控制項的屬性。Gets an attribute of the Web control with the specified name.

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

將 Web 控制項的屬性設定為指定的名稱和值。Sets an attribute of the Web control to the specified name and value.

(繼承來源 WebControl)
IControlBuilderAccessor.ControlBuilder

如需這個成員的說明,請參閱 ControlBuilderFor a description of this member, see ControlBuilder.

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

如需這個成員的說明,請參閱 GetDesignModeState()For a description of this member, see GetDesignModeState().

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

如需這個成員的說明,請參閱 SetDesignModeState(IDictionary)For a description of this member, see SetDesignModeState(IDictionary).

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

如需這個成員的說明,請參閱 SetOwnerControl(Control)For a description of this member, see SetOwnerControl(Control).

(繼承來源 Control)
IControlDesignerAccessor.UserData

如需這個成員的說明,請參閱 UserDataFor a description of this member, see UserData.

(繼承來源 Control)
IDataBindingsAccessor.DataBindings

如需這個成員的說明,請參閱 DataBindingsFor a description of this member, see DataBindings.

(繼承來源 Control)
IDataBindingsAccessor.HasDataBindings

如需這個成員的說明,請參閱 HasDataBindingsFor a description of this member, see HasDataBindings.

(繼承來源 Control)
IExpressionsAccessor.Expressions

如需這個成員的說明,請參閱 ExpressionsFor a description of this member, see Expressions.

(繼承來源 Control)
IExpressionsAccessor.HasExpressions

如需這個成員的說明,請參閱 HasExpressionsFor a description of this member, see HasExpressions.

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

如需這個成員的說明,請參閱 AddParsedSubObject(Object)For a description of this member, see AddParsedSubObject(Object).

(繼承來源 Control)
IPostBackEventHandler.RaisePostBackEvent(String)

處理當表單張貼至伺服器時引發的事件。Processes an event raised when a form is posted to the server.

擴充方法

EnablePersistedSelection(BaseDataBoundControl)
已過時。

啟用要保存於資料控制項中且支援選取和分頁的選項。Enables selection to be persisted in data controls that support selection and paging.

FindDataSourceControl(Control)

傳回與指定之控制項的資料控制項相關聯的資料來源。Returns the data source that is associated with the data control for the specified control.

FindFieldTemplate(Control, String)

傳回在指定之控制項的命名容器中所指定資料行的欄位樣板。Returns the field template for the specified column in the specified control's naming container.

FindMetaTable(Control)

傳回包含資料控制項的中繼資料表物件。Returns the metatable object for the containing data control.

GetDefaultValues(INamingContainer)

取得所指定資料控制項的預設值集合。Gets the collection of the default values for the specified data control.

GetMetaTable(INamingContainer)

取得所指定資料控制項中的資料表中繼資料。Gets the table metadata for the specified data control.

SetMetaTable(INamingContainer, MetaTable)

設定所指定資料控制項中的資料表中繼資料。Sets the table metadata for the specified data control.

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

設定所指定資料控制項的資料表中繼資料及預設值對應。Sets the table metadata and default value mapping for the specified data control.

SetMetaTable(INamingContainer, MetaTable, Object)

設定所指定資料控制項的資料表中繼資料及預設值對應。Sets the table metadata and default value mapping for the specified data control.

TryGetMetaTable(INamingContainer, MetaTable)

判斷資料表中繼資料是否可供使用。Determines whether table metadata is available.

EnableDynamicData(INamingContainer, Type)

針對指定的資料控制項啟用動態資料行為。Enables Dynamic Data behavior for the specified data control.

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

針對指定的資料控制項啟用動態資料行為。Enables Dynamic Data behavior for the specified data control.

EnableDynamicData(INamingContainer, Type, Object)

針對指定的資料控制項啟用動態資料行為。Enables Dynamic Data behavior for the specified data control.

適用於

另請參閱