EditorPartChrome.RenderPartContents(HtmlTextWriter, EditorPart) Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
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
Poniższy przykład kodu pokazuje, jak zastąpić metodę w celu dodania RenderPartContents tekstu do części edytora. Aby uzyskać pełny kod wymagany do uruchomienia przykładu, w tym stronę sieci Web do hostowania tych kontrolek, zobacz sekcję Przykładowe EditorPartChrome omówienie 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 domyślnego renderowania.
Notatki 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ę.