Επεξεργασία

Κοινή χρήση μέσω


EditorZoneBase.RenderBody(HtmlTextWriter) Method

Definition

Overrides the base method to render the body area of a zone derived from the EditorZoneBase class.

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

Parameters

writer
HtmlTextWriter

The HtmlTextWriter that receives the zone's body content.

Examples

The following code example demonstrates how to override the RenderBody method in a derived class. For the full code required to run the example, see the Example section of the EditorZoneBase class overview topic.

The custom editor zone derives from the EditorZone class so that it can be used with a zone template in the declarative markup of the Web page. The custom class overrides the RenderBody method, adding an HTML <hr /> element to create a line between the header and body of the zone. It then calls the base method to render the rest of the zone's body contents.

protected override void RenderBody(HtmlTextWriter writer)
{
  writer.WriteLine("<hr />");
  base.RenderBody(writer);
}
Protected Overrides Sub RenderBody(ByVal writer As _
  HtmlTextWriter)
  writer.WriteLine("<hr />")
  MyBase.RenderBody(writer)
End Sub

When you load the page in a browser, you can select Edit Mode in the drop-down list control to switch to edit mode. You can click the verbs menu (the down arrow) in the title bar of one of the controls, and click Edit to edit the selected control. When the EditorZone control and editing user interface (UI) are visible, you can see the line created between the header and body of the editor zone.

Remarks

The RenderBody method renders the body area of an EditorZoneBase zone, which is the main content area between the header and footer areas and contains EditorPart controls.

The RenderBody method overrides the base method in the WebZone class to provide specialized rendering that addresses layout and style attributes that apply only to EditorZoneBase zones. The method renders a table that contains the entire contents of the body, and within that table, it sets different attribute values depending on various conditions, including the current display mode of the page. If there are no contained controls, it renders the value of the EmptyZoneText property.

Applies to

See also