Partilhar via


WebPart.RenderWebPart Method

Renders the HTML for the body of a Web Part to the client.

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Protected Overridable Sub RenderWebPart ( _
    output As HtmlTextWriter _
)
'Usage
Dim output As HtmlTextWriter

Me.RenderWebPart(output)
protected virtual void RenderWebPart(
    HtmlTextWriter output
)

Parameters

Remarks

The RenderWebPart method may not be called in all cases. For example, it cannot be called when the Web Part is minimized, or if the page is being rendered to a non-HTML device. Additionally, this method may not be called if work items were involved and a thread has timed out. In this case, the RenderWorkItemTimeout method will be executed.

Examples

The following code example shows an overridden RenderWebPart method that renders HtmlTextBox and HtmlButton controls. This code example is part of a larger example provided for the WebPart class.

Protected Overrides Sub RenderWebPart(output As HtmlTextWriter)

    _mytextbox.RenderControl(output);
    _mybutton.RenderControl(output);

End Sub 
protected override void RenderWebPart(HtmlTextWriter output)
{
    _mytextbox.RenderControl(output);
    _mybutton.RenderControl(output);

}

See Also

Reference

WebPart Class

WebPart Members

Microsoft.SharePoint.WebPartPages Namespace