Menu 类

定义

在 ASP.NET 网页中显示菜单。

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 网站项目: 下载

下面的代码示例演示如何使用声明性语法创建 Menu 具有静态菜单项的控件。


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

下面的代码示例演示如何将 Menu 控件绑定到控件 SiteMapDataSource 。 若要使此示例正常工作,必须将下面的示例站点地图数据复制到名为 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>

下面是上一示例的示例站点地图数据。

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

注解

本主题内容:

介绍

控件 Menu 用于在 ASP.NET 网页中显示菜单,并且通常与 SiteMapDataSource 导航网站的控件结合使用。 控件 Menu 支持以下功能:

  • 允许控件的菜单项绑定到层次结构数据源的数据绑定。

  • 通过与 控件的集成进行 SiteMapDataSource 网站导航。

  • 以编程方式访问 Menu 对象模型,以动态创建菜单、填充菜单项、设置属性等。

  • 可通过主题、用户定义的图像、样式和用户定义的模板自定义外观。

当用户单击菜单项时, Menu 控件可以导航到链接的网页,也可以直接发回服务器。 NavigateUrl如果设置了菜单项的 属性,控件将Menu导航到链接页;否则,它会将页面发回服务器进行处理。 默认情况下,链接页显示在与控件相同的窗口或框架中 Menu 。 若要在不同的窗口或框架中显示链接内容,请使用 Target 控件的 Menu 属性。

注意

属性 Target 影响控件中的每个菜单项。 若要为单个菜单项指定窗口或框架,请直接设置 Target 对象的 MenuItem 属性。

控件 Menu 显示两种类型的菜单:静态菜单和动态菜单。 静态菜单始终显示在 控件中 Menu 。 默认情况下,根级别 (级别 0) 的菜单项显示在静态菜单中。 可以通过设置 StaticDisplayLevels 属性,在静态菜单中显示其他菜单级别 (静态子菜单) 。 如果任何级别高于 属性指定的 StaticDisplayLevels 值的) 显示在动态菜单中,则菜单项 (。 仅当用户将鼠标指针放在包含动态子菜单的父菜单项上时,才会显示动态菜单。 动态菜单在一定持续时间后自动消失。 DisappearAfter使用 属性指定持续时间。

注意

当用户单击菜单外部时,动态菜单也会消失。

还可以通过设置 MaximumDynamicDisplayLevels 属性来限制动态菜单中显示的级别数。 高于指定值的菜单级别将被丢弃。

注意

控件 Menu 不设计为在 控件内 UpdatePanel 使用。 只能将 Menu 控件添加到控件外部 UpdatePanel 的页面。 UpdatePanel 控件用于更新页面的选定区域,而不是使用回发更新整个页面。 有关详细信息,请参阅 UpdatePanel 控件概述分页呈现概述

控件 Menu 由由 对象表示 MenuItem 的菜单项树组成。 顶级 (级别 0) 的菜单项称为根菜单项。 具有父菜单项的菜单项称为子菜单项。 所有根菜单项都存储在 集合中 Items 。 子菜单项存储在父菜单项的 ChildItems 集合中。

每个菜单项都有 TextValue 属性。 属性的值 Text 显示在 控件中 Menu ,而 Value 属性用于存储有关菜单项的任何其他数据,例如传递给与菜单项关联的回发事件的数据。 单击后,菜单项可以导航到 属性 NavigateUrl 指示的另一个网页。

注意

NavigateUrl如果未为菜单项设置 属性,控件Menu只需在单击菜单项时将页面提交到服务器进行处理。

还可以选择通过设置 ImageUrl 属性在菜单项中显示图像。

有关菜单项的详细信息,请参阅 MenuItem

静态数据

控件最简单的数据模型 Menu 是静态菜单项。 若要使用声明性语法显示静态菜单项,请先在控件的开始标记和结束 <Items> 标记之间嵌套开始标记和结束标记 Menu 。 接下来,通过在开始标记和结束<Items>标记之间嵌套<asp:MenuItem>元素来创建菜单结构。 每个 <asp:MenuItem> 元素表示 控件中的一个菜单项,并映射到 对象 MenuItem 。 可以通过设置其 <asp:MenuItem> 元素的属性来设置每个菜单项的属性。 若要创建子菜单项,请在父菜单项的开始标记和结束<asp:MenuItem>标记之间嵌套其他<asp:MenuItem>元素。

绑定到数据

控件 Menu 可以使用任何层次结构数据源控件,例如 XmlDataSource 控件或 SiteMapDataSource 控件。 若要绑定到层次结构数据源控件,请将 控件的 Menu 属性设置为DataSourceIDID数据源控件的值。 控件 Menu 自动绑定到指定的数据源控件。 这是绑定到数据的首选方法。

绑定到数据源时,其中每个数据项包含多个属性 (例如具有多个属性) 的 XML 元素,菜单项默认显示数据项的 方法返回 ToString 的值。 对于 XML 元素,菜单项将显示元素名称,该名称显示菜单树的基础结构,但不是很有用。 通过使用 集合指定菜单项绑定,可以将菜单项绑定到特定的数据项属性 DataBindings 。 集合 DataBindings 包含 MenuItemBinding 定义数据项与它绑定到的菜单项之间的关系的对象。 可以指定要在节点中显示的绑定条件和数据项属性。 有关菜单项绑定的详细信息,请参阅 MenuItemBinding

通过将 或 TextField 属性设置为Text空字符串 (“”) ,无法在控件中创建Menu空节点。 将这些属性设置为空字符串的效果与不设置属性的效果相同。 在这种情况下, Menu 控件使用 DataSource 属性创建默认绑定。 有关详细信息,请参阅 绑定到数据库

自定义用户界面

可通过多种方式自定义控件的外观 Menu 。 首先,可以通过设置 Orientation 属性来指定控件是水平呈现还是Menu垂直呈现。 还可以为每个菜单项类型指定不同的样式 (如字号和颜色) 。

如果使用级联样式表 (CSS) 来自定义控件的外观,请使用内联样式或单独的 CSS 文件,但不能同时使用这两者。 同时使用内联样式和单独的 CSS 文件可能会导致意外结果。 有关将样式表与控件配合使用的详细信息,请参阅 Web 服务器控件和 CSS 样式

下表列出了可用的菜单项样式。

菜单项样式属性 说明
DynamicHoverStyle 将鼠标指针悬停在动态菜单项上方时的样式设置。
DynamicMenuItemStyle 单个动态菜单项的样式设置。
DynamicMenuStyle 动态菜单的样式设置。
DynamicSelectedStyle 当前所选动态菜单项的样式设置。
StaticHoverStyle 将鼠标指针悬停在静态菜单项上方时的样式设置。
StaticMenuItemStyle 单个静态菜单项的样式设置。
StaticMenuStyle 静态菜单的样式设置。
StaticSelectedStyle 当前所选静态菜单项的样式设置。

可以使用以下样式集合,根据菜单项的级别指定应用于菜单项的样式,而不是设置单个样式属性。

级别样式集合 说明
LevelMenuItemStyles 对象的集合 MenuItemStyle ,这些对象基于级别控制菜单项的样式。
LevelSelectedStyles 对象的集合 MenuItemStyle ,这些对象基于级别控制所选菜单项的样式。
LevelSubMenuStyles 对象的集合 MenuItemStyle ,这些对象基于级别控制子菜单项的样式。

集合中的第一个样式对应于菜单树中第一个深度级别的菜单项的样式。 集合中的第二个样式对应于菜单树中第二个深度级别的菜单项的样式,依此而过。 这最常用于生成目录样式导航菜单,其中特定深度的菜单项应具有相同的外观,无论它们是否具有子菜单。

注意

如果使用上表中列出的任何级别样式集合来定义控件的 Menu 样式,这些样式设置将替代单个菜单项样式属性。

更改控件外观的另一种方法是自定义控件中显示的 Menu 图像。 可以通过设置下表所示的属性,为控件的不同部分指定自己的自定义图像。

Image 属性 说明
DynamicBottomSeparatorImageUrl 显示在动态菜单项底部的可选图像,用于将其与其他菜单项分开。
DynamicPopOutImageUrl 动态菜单项中显示的可选图像,指示它具有子菜单。
DynamicTopSeparatorImageUrl 显示在动态菜单项顶部的可选图像,用于将其与其他菜单项分开。
ScrollDownImageUrl 显示在菜单项底部的图像,指示用户可以向下滚动以查看其他菜单项。
ScrollUpImageUrl 显示在菜单项顶部的图像,指示用户可以向上滚动以查看其他菜单项。
StaticBottomSeparatorImageUrl 静态菜单项底部显示的可选图像,用于将其与其他菜单项分开。
StaticPopOutImageUrl 静态菜单项中显示的可选图像,指示它具有子菜单。
StaticTopSeparatorImageUrl 静态菜单项顶部显示的可选图像,用于将其与其他菜单项分开。

若要完全控制用户界面 (UI) ,可以使用以下模板属性为 Menu 控件定义自己的自定义模板。

Template 属性 说明
DynamicItemTemplate 包含要为动态菜单项呈现的自定义内容的模板。
StaticItemTemplate 包含要为静态菜单项呈现的自定义内容的模板。

通过分别设置 DynamicVerticalOffset 和 属性,可以控制动态菜单相对于其父菜单项的垂直和 DynamicHorizontalOffset 水平位置。 若要控制静态菜单中静态子菜单项的缩进,请使用 StaticSubMenuIndent 属性。

事件

控件 Menu 提供可对其编程的多个事件。 这样,只要发生事件,就可以运行自定义例程。 下表列出了支持的事件。

事件 描述
MenuItemClick 单击菜单项时发生。 此事件通常用于将控件与页面上的另一 Menu 个控件同步。
MenuItemDataBound 当菜单项绑定到数据时发生。 此事件通常用于在控件中 Menu 呈现菜单项之前对其进行修改。

可访问性

有关如何配置此控件以便生成符合辅助功能标准的标记的信息,请参阅 Visual Studio 中的辅助功能和 ASP.NETASP.NET 控件和辅助功能

声明性语法

<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 类的新实例。

字段

MenuItemClickCommandName

包含命令名。

属性

AccessKey

获取或设置使您得以快速导航到 Web 服务器控件的访问键。

(继承自 WebControl)
Adapter

获取控件的浏览器特定适配器。

(继承自 Control)
AppRelativeTemplateSourceDirectory

获取或设置包含该控件的 PageUserControl 对象的应用程序相对虚拟目录。

(继承自 Control)
Attributes

获取与控件的特性不对应的任意特性(只用于呈现)的集合。

(继承自 WebControl)
BackColor

获取或设置 Web 服务器控件的背景色。

(继承自 WebControl)
BindingContainer

获取包含该控件的数据绑定的控件。

(继承自 Control)
BorderColor

获取或设置 Web 控件的边框颜色。

(继承自 WebControl)
BorderStyle

获取或设置 Web 服务器控件的边框样式。

(继承自 WebControl)
BorderWidth

获取或设置 Web 服务器控件的边框宽度。

(继承自 WebControl)
ChildControlsCreated

获取一个值,该值指示是否已创建服务器控件的子控件。

(继承自 Control)
ClientID

获取由 ASP.NET 生成的 HTML 标记的控件 ID。

(继承自 Control)
ClientIDMode

获取或设置用于生成 ClientID 属性值的算法。

(继承自 Control)
ClientIDSeparator

获取一个字符值,该值表示 ClientID 属性中使用的分隔符字符。

(继承自 Control)
Context

为当前 Web 请求获取与服务器控件关联的 HttpContext 对象。

(继承自 Control)
Controls

获取 ControlCollection,其中包含 Menu 控件的子控件。

ControlStyle

获取 Web 服务器控件的样式。 此属性主要由控件开发人员使用。

(继承自 WebControl)
ControlStyleCreated

获取一个值,该值指示是否已为 Style 属性创建了 ControlStyle 对象。 此属性主要由控件开发人员使用。

(继承自 WebControl)
CssClass

获取或设置由 Web 服务器控件在客户端呈现的级联样式表 (CSS) 类。

(继承自 WebControl)
DataBindings

获取 MenuItemBinding 对象的集合,这些对象定义数据项和它所绑定到的菜单项之间的关系。

DataItemContainer

如果命名容器实现 IDataItemContainer,则获取对命名容器的引用。

(继承自 Control)
DataKeysContainer

如果命名容器实现 IDataKeysControl,则获取对命名容器的引用。

(继承自 Control)
DataSource

获取或设置对象,数据绑定控件从该对象中检索其数据项列表。

(继承自 BaseDataBoundControl)
DataSourceID

获取或设置控件的 ID,数据绑定控件从该控件中检索其数据项列表。

(继承自 HierarchicalDataBoundControl)
DesignMode

获取一个值,该值指示是否正在使用设计图面上的一个控件。

(继承自 Control)
DisappearAfter

获取或设置鼠标指针不再置于菜单上后显示动态菜单的持续时间。

DynamicBottomSeparatorImageUrl

获取或设置图像的 URL,该图像显示在各动态菜单项底部,将动态菜单项与其他菜单项隔开。

DynamicEnableDefaultPopOutImage

获取或设置一个值,该值指示是否显示内置图像,其中内置图像指示动态菜单项具有子菜单。

DynamicHorizontalOffset

获取或设置动态菜单相对于其父菜单项的水平移动像素数。

DynamicHoverStyle

获取对 Style 对象的引用,使用该对象可以设置鼠标指针置于动态菜单项上时的菜单项外观。

DynamicItemFormatString

获取或设置与所有动态显示的菜单项一起显示的附加文本。

DynamicItemTemplate

获取或设置包含动态菜单自定义呈现内容的模板。

DynamicMenuItemStyle

获取对 MenuItemStyle 对象的引用,使用该对象可以设置动态菜单中的菜单项的外观。

DynamicMenuStyle

获取对 MenuItemStyle 对象的引用,使用该对象可以设置动态菜单的外观。

DynamicPopOutImageTextFormatString

获取或设置用于指示动态菜单项包含子菜单的图像的替换文字。

DynamicPopOutImageUrl

获取或设置自定义图像的 URL,如果动态菜单项包含子菜单,该图像则显示在动态菜单项中。

DynamicSelectedStyle

获取对 MenuItemStyle 对象的引用,使用该对象可以设置用户所选动态菜单项的外观。

DynamicTopSeparatorImageUrl

获取或设置图像的 URL,该图像显示在各动态菜单项顶部,将动态菜单项与其他菜单项隔开。

DynamicVerticalOffset

获取或设置动态菜单相对于其父菜单项的垂直移动像素数。

Enabled

获取或设置一个值,该值指示是否启用 Web 服务器控件。

(继承自 WebControl)
EnableTheming

获取或设置一个值,该值指示主题是否应用于该控件。

(继承自 WebControl)
EnableViewState

获取或设置一个值,该值指示服务器控件是否向发出请求的客户端保持自己的视图状态以及它所包含的任何子控件的视图状态。

(继承自 Control)
Events

获取控件的事件处理程序委托列表。 此属性为只读。

(继承自 Control)
Font

获取与 Web 服务器控件关联的字体属性。

(继承自 WebControl)
ForeColor

获取或设置 Web 服务器控件的前景色(通常是文本颜色)。

(继承自 WebControl)
HasAttributes

获取一个值,该值指示控件是否具有特性集。

(继承自 WebControl)
HasChildViewState

获取一个值,该值指示当前服务器控件的子控件是否具有任何已保存的视图状态设置。

(继承自 Control)
Height

获取或设置 Web 服务器控件的高度。

(继承自 WebControl)
ID

获取或设置分配给服务器控件的编程标识符。

(继承自 Control)
IdSeparator

获取用于分隔控件标识符的字符。

(继承自 Control)
IncludeStyleBlock

获取或设置一个值,该值指示 ASP.NET 是否应呈现菜单中所使用样式的级联样式表 (CSS) 定义块。

Initialized

获取一个值,该值指示数据绑定控件是否已经初始化。

(继承自 BaseDataBoundControl)
IsBoundUsingDataSourceID

获取指示是否设置 DataSourceID 属性的值。

(继承自 BaseDataBoundControl)
IsChildControlStateCleared

获取一个值,该值指示该控件中包含的控件是否具有控件状态。

(继承自 Control)
IsDataBindingAutomatic

获取一个值,该值指示数据绑定是否自动进行。

(继承自 BaseDataBoundControl)
IsEnabled

获取一个值,该值指示是否启用控件。

(继承自 WebControl)
IsTrackingViewState

获取一个值,用于指示服务器控件是否会将更改保存到其视图状态中。

(继承自 Control)
IsUsingModelBinders

在派生类中实现时,获取一个值,该值指示控件是否使用模型联编程序。

(继承自 BaseDataBoundControl)
IsViewStateEnabled

获取一个值,该值指示是否为该控件启用了视图状态。

(继承自 Control)
Items

获取 MenuItemCollection 对象,该对象包含 Menu 控件中的所有菜单项。

ItemWrap

获取或设置一个值,该值指示菜单项的文本是否换行。

LevelMenuItemStyles

获取 MenuItemStyleCollection 对象,该对象包含的样式设置是根据菜单项在 Menu 控件中的级别应用于菜单项的。

LevelSelectedStyles

获取 MenuItemStyleCollection 对象,该对象包含的样式设置是根据所选菜单项在 Menu 控件中的级别应用于该菜单项的。

LevelSubMenuStyles

获取 MenuItemStyleCollection 对象,该对象包含的样式设置是根据静态菜单的子菜单项在 Menu 控件中的级别应用于这些子菜单项的。

LoadViewStateByID

获取一个值,该值指示控件是否通过 ID 而不是索引参与加载其视图状态。

(继承自 Control)
MaximumDynamicDisplayLevels

获取或设置动态菜单的菜单呈现级别数。

NamingContainer

获取对服务器控件的命名容器的引用,此引用创建唯一的命名空间,以区分具有相同 ID 属性值的服务器控件。

(继承自 Control)
Orientation

获取或设置 Menu 控件的呈现方向。

Page

获取对包含服务器控件的 Page 实例的引用。

(继承自 Control)
Parent

获取对页 UI 层次结构中服务器控件的父控件的引用。

(继承自 Control)
PathSeparator

获取或设置用于分隔 Menu 控件的菜单项路径的字符。

RenderingCompatibility

获取一个值,该值指定呈现的 HTML 将与之兼容的 ASP.NET 版本。

(继承自 Control)
RenderingMode

获取或设置一个值,该值指定 Menu 控件是呈现 HTML table 元素和内联样式,还是呈现 listitem 元素和级联样式表 (CSS) 样式。

RequiresDataBinding

获取或设置一个值,该值指示是否应调用 DataBind() 方法。

(继承自 BaseDataBoundControl)
ScrollDownImageUrl

获取或设置动态菜单中显示的图像的 URL,以指示用户可以向下滚动查看更多菜单项。

ScrollDownText

获取或设置 ScrollDownImageUrl 属性中指定的图像的替换文字。

ScrollUpImageUrl

获取或设置动态菜单中显示的图像的 URL,以指示用户可以向上滚动查看更多菜单项。

ScrollUpText

获取或设置 ScrollUpImageUrl 属性中指定的图像的替换文字。

SelectedItem

获取选定的菜单项。

SelectedValue

获取选定菜单项的值。

Site

获取容器信息,该容器在呈现于设计图面上时承载当前控件。

(继承自 Control)
SkinID

获取或设置要应用于控件的外观。

(继承自 WebControl)
SkipLinkText

获取或设置屏幕读取器所读取的隐藏图像的替换文字,以提供跳过链接列表的功能。

StaticBottomSeparatorImageUrl

获取或设置图像的 URL,该图像在各静态菜单项底部显示为分隔符。

StaticDisplayLevels

获取或设置静态菜单的菜单显示级别数。

StaticEnableDefaultPopOutImage

获取或设置一个值,该值指示是否显示内置图像,其中内置图像指示静态菜单项包含子菜单。

StaticHoverStyle

获取对 Style 对象的引用,使用该对象可以设置鼠标指针置于静态菜单项上时的菜单项外观。

StaticItemFormatString

获取或设置与所有静态显示的菜单项一起显示的附加文本。

StaticItemTemplate

获取或设置包含静态菜单自定义呈现内容的模板。

StaticMenuItemStyle

获取对 MenuItemStyle 对象的引用,使用该对象可以设置静态菜单中的菜单项的外观。

StaticMenuStyle

获取对 MenuItemStyle 对象的引用,使用该对象可以设置静态菜单的外观。

StaticPopOutImageTextFormatString

获取或设置用于指示静态菜单项包含子菜单的弹出图像的替换文字。

StaticPopOutImageUrl

获取或设置显示来指示静态菜单项包含子菜单的图像的 URL。

StaticSelectedStyle

获取对 MenuItemStyle 对象的引用,使用该对象可以设置用户在静态菜单中选择的菜单项的外观。

StaticSubMenuIndent

获取或设置静态菜单中子菜单的缩进间距(以像素为单位)。

StaticTopSeparatorImageUrl

获取或设置图像的 URL,该图像在各静态菜单项顶部显示为分隔符。

Style

获取将在 Web 服务器控件的外部标记上呈现为样式特性的文本特性的集合。

(继承自 WebControl)
SupportsDisabledAttribute

获取一个值,该值指示在控件的 disabled 属性为 IsEnabled 时,控件是否应将呈现的 HTML 元素的 false 特性设置为 "disabled"。

(继承自 BaseDataBoundControl)
TabIndex

获取或设置 Web 服务器控件的选项卡索引。

(继承自 WebControl)
TagKey

获取对应于 HtmlTextWriterTag 控件的 Menu 值。 此属性主要由控件开发人员使用。

TagName

获取控件标记的名称。 此属性主要由控件开发人员使用。

(继承自 WebControl)
Target

获取或设置用来显示菜单项的关联网页内容的目标窗口或框架。

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 特性和样式添加到指定的 HtmlTextWriter 对象。

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)
ConfirmInitState()

设置数据绑定控件的初始化状态。

(继承自 BaseDataBoundControl)
CopyBaseAttributes(WebControl)

Style 对象未封装的属性从指定的 Web 服务器控件复制到从中调用此方法的 Web 服务器控件。 此方法主要由控件开发人员使用。

(继承自 WebControl)
CreateChildControls()

创建 Menu 控件的子控件。

CreateControlCollection()

创建一个新 ControlCollection 对象来保存服务器控件的子控件(包括文本控件和服务器控件)。

(继承自 Control)
CreateControlStyle()

创建由 WebControl 类在内部用来实现所有与样式有关的属性的样式对象。 此方法主要由控件开发人员使用。

(继承自 WebControl)
DataBind()

将数据源绑定到 Menu 控件。 无法继承此方法。

DataBind(Boolean)

将数据源绑定到调用的服务器控件及其所有子控件,同时可以选择引发 DataBinding 事件。

(继承自 Control)
DataBindChildren()

将数据源绑定到服务器控件的子控件。

(继承自 Control)
Dispose()

使服务器控件得以在从内存中释放之前执行最后的清理操作。

(继承自 Control)
EndRenderTracing(TextWriter, Object)

结束输出数据的设计时追踪。

(继承自 Control)
EnsureChildControls()

确定服务器控件是否包含子控件。 如果不包含,则创建子控件。

(继承自 Control)
EnsureDataBound()

确认菜单控件是否需要数据绑定,以及是否在调用 DataBind() 方法前指定了有效的数据源控件。

EnsureID()

为尚未分配标识符的控件创建标识符。

(继承自 Control)
Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
FindControl(String)

在当前的命名容器中搜索带指定 id 参数的服务器控件。

(继承自 Control)
FindControl(String, Int32)

使用指定的 idpathOffset 参数(该参数有助于搜索)中指定的整数在当前命名容器中搜索服务器控件。 不应重写此版本的 FindControl 方法。

(继承自 Control)
FindItem(String)

检索位于指定值路径的菜单项。

Focus()

为控件设置输入焦点。

(继承自 Control)
GetData(String)

检索数据绑定控件用于执行数据操作的 HierarchicalDataSourceView 对象。

(继承自 HierarchicalDataBoundControl)
GetDataSource()

如果存在与数据绑定控件关联的 IHierarchicalDataSource,则检索它。

(继承自 HierarchicalDataBoundControl)
GetDesignModeState()

检索 Menu 控件的设计时状态。

GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetRouteUrl(Object)

获取与一组路由参数对应的 URL。

(继承自 Control)
GetRouteUrl(RouteValueDictionary)

获取与一组路由参数对应的 URL。

(继承自 Control)
GetRouteUrl(String, Object)

获取与一组路由参数以及某个路由名称对应的 URL。

(继承自 Control)
GetRouteUrl(String, RouteValueDictionary)

获取与一组路由参数以及某个路由名称对应的 URL。

(继承自 Control)
GetType()

获取当前实例的 Type

(继承自 Object)
GetUniqueIDRelativeTo(Control)

返回指定控件的 UniqueID 属性的前缀部分。

(继承自 Control)
HasControls()

确定服务器控件是否包含任何子控件。

(继承自 Control)
HasEvents()

返回一个值,该值指示是否为控件或任何子控件注册事件。

(继承自 Control)
IsLiteralContent()

确定服务器控件是否只包含文字内容。

(继承自 Control)
LoadControlState(Object)

加载 Menu 控件中需要保留的属性的状态。

LoadViewState(Object)

加载以前保存的 Menu 控件的视图状态。

MapPathSecure(String)

检索虚拟路径(绝对的或相对的)映射到的物理路径。

(继承自 Control)
MarkAsDataBound()

将视图状态中的控件状态设置为成功绑定到数据。

(继承自 HierarchicalDataBoundControl)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
MergeStyle(Style)

将指定样式的所有非空白元素复制到 Web 控件,但不覆盖该控件现有的任何样式元素。 此方法主要由控件开发人员使用。

(继承自 WebControl)
OnBubbleEvent(Object, EventArgs)

确定 Menu 控件的事件是否沿页的用户界面 (UI) 服务器控件层次结构向上传递。

OnDataBinding(EventArgs)

引发 DataBinding 事件。

OnDataBound(EventArgs)

引发 DataBound 事件。

(继承自 BaseDataBoundControl)
OnDataPropertyChanged()

在其中一个基数据源标识属性更改时被调用,以将数据绑定控件重新绑定到其数据。

(继承自 HierarchicalDataBoundControl)
OnDataSourceChanged(Object, EventArgs)

在与数据绑定控件一起使用的 IHierarchicalDataSource 实例引发 DataSourceChanged 事件时被调用。

(继承自 HierarchicalDataBoundControl)
OnInit(EventArgs)

引发 Init 事件。

OnLoad(EventArgs)

处理 Load 事件。

(继承自 HierarchicalDataBoundControl)
OnMenuItemClick(MenuEventArgs)

引发 MenuItemClick 事件。

OnMenuItemDataBound(MenuEventArgs)

引发 MenuItemDataBound 事件。

OnPagePreLoad(Object, EventArgs)

在加载数据绑定控件之前设置该控件的初始化状态。

(继承自 HierarchicalDataBoundControl)
OnPreRender(EventArgs)

引发 PreRender 事件。

OnUnload(EventArgs)

引发 Unload 事件。

(继承自 Control)
OpenFile(String)

获取用于读取文件的 Stream

(继承自 Control)
PerformDataBinding()

将数据源中的项绑定到 Menu 控件中的菜单项。

PerformSelect()

从关联的数据源中检索数据。

(继承自 HierarchicalDataBoundControl)
RaiseBubbleEvent(Object, EventArgs)

将所有事件源及其信息分配给控件的父级。

(继承自 Control)
RaisePostBackEvent(String)

处理窗体发送到服务器时引发的事件。

RemovedControl(Control)

Control 对象的 Controls 集合移除子控件后调用。

(继承自 Control)
Render(HtmlTextWriter)

在客户端浏览器上呈现菜单控件。

RenderBeginTag(HtmlTextWriter)

添加标记特性,并将表示控件开始标记的标志写入到将被发送至浏览器或设备的输出流中。

RenderChildren(HtmlTextWriter)

将服务器控件子级的内容输出到提供的 HtmlTextWriter 对象,该对象可写入要在客户端上呈现的内容。

(继承自 Control)
RenderContents(HtmlTextWriter)

此成员重写 RenderContents(HtmlTextWriter)

RenderControl(HtmlTextWriter)

将服务器控件内容输出到所提供的 HtmlTextWriter 对象,如果启用了跟踪,则还将存储有关该控件的跟踪信息。

(继承自 Control)
RenderControl(HtmlTextWriter, ControlAdapter)

使用提供的 HtmlTextWriter 对象将服务器控件内容输出到提供的 ControlAdapter 对象。

(继承自 Control)
RenderEndTag(HtmlTextWriter)

执行最终的标记,并将控件的 HTML 结束标记写入到将被发送至浏览器或设备的输出流中。

ResolveAdapter()

获取负责呈现指定控件的控件适配器。

(继承自 Control)
ResolveClientUrl(String)

获取浏览器可以使用的 URL。

(继承自 Control)
ResolveUrl(String)

将 URL 转换为在请求客户端可用的 URL。

(继承自 Control)
SaveControlState()

保存 Menu 控件中需要保留的属性的状态。

SaveViewState()

保存 Menu 控件的状态。

SetDesignModeState(IDictionary)

Menu 控件设置设计时数据。

SetItemDataBound(MenuItem, Boolean)

用指定的值设置指定的 DataBound 对象的 MenuItem 属性。

SetItemDataItem(MenuItem, Object)

用指定的值设置指定的 DataItem 对象的 MenuItem 属性。

SetItemDataPath(MenuItem, String)

用指定的值设置指定的 DataPath 对象的 MenuItem 属性。

SetRenderMethodDelegate(RenderMethod)

分配事件处理程序委托,以将服务器控件及其内容呈现到父控件中。

(继承自 Control)
SetTraceData(Object, Object)

使用跟踪数据键和跟踪数据值,为呈现数据的设计时追踪设置跟踪数据。

(继承自 Control)
SetTraceData(Object, Object, Object)

使用跟踪对象、跟踪数据键和跟踪数据值,为呈现数据的设计时追踪设置跟踪数据。

(继承自 Control)
ToString()

返回表示当前对象的字符串。

(继承自 Object)
TrackViewState()

跟踪 Menu 控件的视图状态更改,以便可以将更改存储在该控件的 StateBag 对象中。 通过 ViewState 属性可访问此对象。

ValidateDataSource(Object)

验证数据绑定控件绑定到的对象是否可以和该控件一同使用。

(继承自 HierarchicalDataBoundControl)

事件

DataBinding

当服务器控件绑定到数据源时发生。

(继承自 Control)
DataBound

在服务器控件绑定到数据源后发生。

(继承自 BaseDataBoundControl)
Disposed

当从内存释放服务器控件时发生,这是请求 ASP.NET 页时服务器控件生存期的最后阶段。

(继承自 Control)
Init

当服务器控件初始化时发生;初始化是控件生存期的第一步。

(继承自 Control)
Load

当服务器控件加载到 Page 对象中时发生。

(继承自 Control)
MenuItemClick

在单击 Menu 控件中的菜单项时发生。

MenuItemDataBound

Menu 控件中的菜单项绑定到数据时发生。

PreRender

在加载 Control 对象之后、呈现之前发生。

(继承自 Control)
Unload

当服务器控件从内存中卸载时发生。

(继承自 Control)

显式接口实现

IAttributeAccessor.GetAttribute(String)

获取具有指定名称的 Web 控件的特性。

(继承自 WebControl)
IAttributeAccessor.SetAttribute(String, String)

将 Web 控件的特性设置为指定的名称和值。

(继承自 WebControl)
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)
IPostBackEventHandler.RaisePostBackEvent(String)

处理窗体发送到服务器时引发的事件。

扩展方法

EnablePersistedSelection(BaseDataBoundControl)
已过时.

使选定内容能够保留在支持选择和分页的数据控件中。

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)

为指定数据控件启用动态数据行为。

适用于

另请参阅