Edit

Share via


EditorPartChrome.RenderPartContents(HtmlTextWriter, EditorPart) Method

Definition

Renders the main content area of an EditorPart control, excluding the header and footer.

protected:
 virtual void RenderPartContents(System::Web::UI::HtmlTextWriter ^ writer, System::Web::UI::WebControls::WebParts::EditorPart ^ editorPart);
protected virtual void RenderPartContents (System.Web.UI.HtmlTextWriter writer, System.Web.UI.WebControls.WebParts.EditorPart editorPart);
abstract member RenderPartContents : System.Web.UI.HtmlTextWriter * System.Web.UI.WebControls.WebParts.EditorPart -> unit
override this.RenderPartContents : System.Web.UI.HtmlTextWriter * System.Web.UI.WebControls.WebParts.EditorPart -> unit
Protected Overridable Sub RenderPartContents (writer As HtmlTextWriter, editorPart As EditorPart)

Parameters

writer
HtmlTextWriter

The HtmlTextWriter that receives the editorPart content.

editorPart
EditorPart

The control currently being rendered.

Examples

The following code example demonstrates how to override the RenderPartContents method to add text to the editor part. For the full code required to run the example, including the Web page to host these controls, see the Example section of the EditorPartChrome class overview.

protected override void RenderPartContents(HtmlTextWriter writer, EditorPart editorPart)
{
    writer.AddStyleAttribute("color", "red");
    writer.RenderBeginTag("p");
    writer.Write("Apply all changes");
    writer.RenderEndTag();
    editorPart.RenderControl(writer);
}
Protected Overrides Sub RenderPartContents(ByVal writer As System.Web.UI.HtmlTextWriter, ByVal editorPart As System.Web.UI.WebControls.WebParts.EditorPart)
    writer.AddStyleAttribute("color", "red")
    writer.RenderBeginTag("p")
    writer.Write("Apply all changes")
    writer.RenderEndTag()
    editorPart.RenderControl(writer)
End Sub

Remarks

The RenderPartContents method enables you to override the rendering of the body area of editorPart, while leaving rendering of the header and footer to the default rendering.

Notes to Inheritors

You can optionally override the RenderPartContents(HtmlTextWriter, EditorPart) method. If so, you can simply perform whatever rendering customizations you want for editorPart, and then call its RenderControl(HtmlTextWriter) method.

Applies to