MenuAdapter 类

定义

提供用于修改特定浏览器的 Menu 控件行为的方法。Provides the means to modify the behavior of the Menu control for specific browsers.

public ref class MenuAdapter : System::Web::UI::WebControls::Adapters::WebControlAdapter, System::Web::UI::IPostBackEventHandler
public class MenuAdapter : System.Web.UI.WebControls.Adapters.WebControlAdapter, System.Web.UI.IPostBackEventHandler
type MenuAdapter = class
    inherit WebControlAdapter
    interface IPostBackEventHandler
Public Class MenuAdapter
Inherits WebControlAdapter
Implements IPostBackEventHandler
继承
实现

注解

MenuAdapter Menu 用于修改特定浏览器或浏览器类的控件的标记或行为,或充当某些功能的筛选器。A MenuAdapter modifies the markup or behavior of a Menu control for a specific browser or class of browsers, or acts as a filter on some capability.

默认情况下, MenuItem 控件中的对象 Menu 呈现为超链接,以容纳菜单导航。By default, the MenuItem objects in the Menu control are rendered as hyperlinks to accommodate menu navigation. Menu类通过实现接口来维护状态, IPostBackEventHandler 以便它能够在回发期间响应和引发特定事件。The Menu class maintains state by implementing the IPostBackEventHandler interface so that it can respond to and raise specific events during postback. 您可以扩展 MenuAdapter 类,以便进一步自定义控件的呈现或行为 MenuYou can extend the MenuAdapter class to further customize rendering or behavior of the Menu control.

对于适配器,初始请求会导致 .NET Framework 在给定请求浏览器特征的情况下搜索该控件的映射适配器。The initial request for an adapter causes the .NET Framework to search for a mapped adapter for the control, given the characteristics of the requesting browser. HttpBrowserCapabilities类使用浏览器定义文件来识别客户端浏览器的特征并将适配器映射到浏览器类型。The HttpBrowserCapabilities class uses browser definition files to identify the characteristics of the client browser and to map the adapter to the browser type.

有关 ASP.NET 中的自适应呈现的详细信息,请参阅 自适应控件行为的结构概述For more information about adaptive rendering in ASP.NET, see Architectural Overview of Adaptive Control Behavior.

构造函数

MenuAdapter()

初始化 MenuAdapter 类的新实例。Initializes a new instance of the MenuAdapter class.

属性

Browser

获取对发出当前 HTTP 请求的客户端的浏览器功能的引用。Gets a reference to the browser capabilities of the client making the current HTTP request.

(继承自 ControlAdapter)
Control

检索对与此 Menu 对象关联的 MenuAdapter 控件的强类型引用。Retrieves a strongly typed reference to the Menu control associated with this MenuAdapter object.

IsEnabled

获取一个值,该值指示是否已启用该 Web 控件及其所有父控件。Gets a value indicating whether the Web control and all its parent controls are enabled.

(继承自 WebControlAdapter)
Page

获取对与此适配器关联的控件所驻留的页的引用。Gets a reference to the page where the control associated with this adapter resides.

(继承自 ControlAdapter)
PageAdapter

获取对关联控件所驻留的页的页适配器的引用。Gets a reference to the page adapter for the page where the associated control resides.

(继承自 ControlAdapter)

方法

BeginRender(HtmlTextWriter)

在呈现控件前调用。Called prior to the rendering of a control. 在派生的 adapter 类中,生成特定目标需要但 HTML 浏览器不需要的开始标记。In a derived adapter class, generates opening tags that are required by a specific target but not needed by HTML browsers.

(继承自 ControlAdapter)
CreateChildControls()

为复合控件创建特定于目标的子控件。Creates the target-specific child controls for a composite control.

(继承自 ControlAdapter)
EndRender(HtmlTextWriter)

在呈现控件后调用。Called after the rendering of a control. 在派生的 adapter 类中,生成特定目标需要但 HTML 浏览器不需要的结束标记。In a derived adapter class, generates closing tags that are required by a specific target but not needed by HTML browsers.

(继承自 ControlAdapter)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
LoadAdapterControlState(Object)

加载 SaveAdapterControlState() 方法在对页面的前一个请求期间保存的任何控件状态信息。Loads any control state information that was saved by the SaveAdapterControlState() method during a previous request to the page.

LoadAdapterViewState(Object)

加载适配器视图状态信息,该信息由 SaveAdapterViewState() 在以前请求与此控件适配器关联的控件所驻留的页时保存。Loads adapter view state information that was saved by SaveAdapterViewState() during a previous request to the page where the control associated with this control adapter resides.

(继承自 ControlAdapter)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnInit(EventArgs)

将关联的 Menu 控件注册为一个要求控件状态的控件。Registers the associated Menu control as one that requires control state.

OnLoad(EventArgs)

重写关联控件的 OnLoad(EventArgs) 方法。Overrides the OnLoad(EventArgs) method for the associated control.

(继承自 ControlAdapter)
OnPreRender(EventArgs)

处理关联的 OnPreRender(EventArgs) 控件的 Menu 方法。Handles the OnPreRender(EventArgs) method for the associated Menu control.

OnUnload(EventArgs)

重写关联控件的 OnUnload(EventArgs) 方法。Overrides the OnUnload(EventArgs) method for the associated control.

(继承自 ControlAdapter)
RaisePostBackEvent(String)

用于在引发回发事件时维护菜单的路径。Used to maintain the path of the menu when a postback event is raised.

Render(HtmlTextWriter)

为附加了控件适配器的控件生成目标特定的标记。Generates the target-specific markup for the control to which the control adapter is attached.

(继承自 WebControlAdapter)
RenderBeginTag(HtmlTextWriter)

添加标记特性,并将表示控件开始标记的标志写入到将被发送至浏览器或设备的输出流中。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)

为附加了控件适配器的复合控件中的子控件生成特定于目标的标记。Generates the target-specific markup for the child controls in a composite control to which the control adapter is attached.

(继承自 ControlAdapter)
RenderContents(HtmlTextWriter)

将关联的 Menu 控件中关联的菜单项作为一系列超链接写入到输出流。Writes the associated menu items in the associated Menu control to the output stream as a series of hyperlinks.

RenderEndTag(HtmlTextWriter)

创建最终的标记,并将控件的结束标记 (tag) 的标记 (markup) 写入发出至浏览器或设备的输出流。Creates final markup and writes the markup for the closing tag of the control to the output stream emitted to the browser or device.

RenderItem(HtmlTextWriter, MenuItem, Int32)

将一个菜单项以超链接的形式呈现。Renders a single menu item as a hyperlink.

SaveAdapterControlState()

保存自页面回发到服务器以来对适配器私有控件状态所做的任何更改。Saves any changes to the adapter private control state that have occurred since the page was posted back to the server.

SaveAdapterViewState()

保存控件适配器的视图状态信息。Saves view state information for the control adapter.

(继承自 ControlAdapter)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

IPostBackEventHandler.RaisePostBackEvent(String)

赋予 MenuAdapter 类处理将页面回发到服务器时引发的事件的能力。Enables the MenuAdapter class to process an event raised when a page is posted back to the server.

适用于

另请参阅