EditorPartChrome.RenderPartContents(HtmlTextWriter, EditorPart) Metoda

Definicja

Renderuje główny obszar zawartości kontrolki EditorPart , z wyłączeniem nagłówka i stopki.

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)

Parametry

writer
HtmlTextWriter

Element HtmlTextWriter odbierający editorPart zawartość.

editorPart
EditorPart

Kontrolka jest obecnie renderowana.

Przykłady

W poniższym przykładzie kodu pokazano, jak zastąpić metodę RenderPartContents w celu dodania tekstu do części edytora. Pełny kod wymagany do uruchomienia przykładu, w tym strona internetowa do hostowania tych kontrolek, można znaleźć w sekcji Przykład w przeglądzie EditorPartChrome klasy.

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

Uwagi

Metoda RenderPartContents umożliwia zastąpienie renderowania obszaru treści elementu editorPart, pozostawiając renderowanie nagłówka i stopki do renderowania domyślnego.

Uwagi dotyczące dziedziczenia

Opcjonalnie można zastąpić metodę RenderPartContents(HtmlTextWriter, EditorPart) . Jeśli tak, możesz po prostu wykonać dowolne dostosowania renderowania dla editorPartelementu , a następnie wywołać jego RenderControl(HtmlTextWriter) metodę.

Dotyczy