MenuAdapter.RenderContents(HtmlTextWriter) 方法

定义

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

protected:
 override void RenderContents(System::Web::UI::HtmlTextWriter ^ writer);
protected override void RenderContents (System.Web.UI.HtmlTextWriter writer);
override this.RenderContents : System.Web.UI.HtmlTextWriter -> unit
Protected Overrides Sub RenderContents (writer As HtmlTextWriter)

参数

writer
HtmlTextWriter

包含可生成和呈现特定于设备的输出的方法的 HtmlTextWriterThe HtmlTextWriter containing methods to build and render the device-specific output.

例外

当前项的深度超出了允许范围。The depth of the current item is more than allowed.

- 或 --or-

禁用了当前项。The current item is disabled.

注解

RenderContents方法将 MenuItem 关联控件的对象 Menu 作为超链接写入到输出流中。The RenderContents method writes the MenuItem objects of the associated Menu control to the output stream as hyperlinks. RenderContents方法是从方法调用的 Render ,用于对呈现到设备浏览器的标记代码进行修改。The RenderContents method is called from the Render method and is used to perform modifications to the markup code that is rendered to a device browser.

控件属性应该在生命周期的此阶段之前设置,并且仅在此处完成控件的实际标记创建。Control properties should be set prior to this phase of the life cycle, and only the actual markup creation for the control done here. 在生命周期的此阶段对控件所做的更改不会保存到视图状态。Changes made to the control in this stage of the life cycle are not saved to view state. 若要保存对控件所做的更改,请重写 OnPreRender 事件。For saving changes made to the control, override the OnPreRender event.

适用于

另请参阅