Label.RenderContents Method (HtmlTextWriter)


This API supports the product infrastructure and is not intended to be used directly from your code.

Renders the contents of the Label into the specified writer.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

Protected Friend Overrides Sub RenderContents (
	writer As HtmlTextWriter


Type: System.Web.UI.HtmlTextWriter

The output stream that renders HTML content to the client.

The following code example demonstrates how to override the RenderContents method in a custom server control so that some text is appended to the Label.

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" >
        <title>Custom Label - RenderContents - VB.NET Example</title>
        <form id="Form1" method="post" runat="server">
            <h3>Custom Label - RenderContents - VB.NET Example</h3>

            <aspSample:CustomLabelRenderContents id="Label1" runat="server" 
             ToolTip="Microsoft Corp.">Microsoft Corp.</aspSample:CustomLabelRenderContents>

<AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class CustomLabelRenderContents
    Inherits System.Web.UI.WebControls.Label

    Protected Overrides Sub RenderContents(ByVal writer As System.Web.UI.HtmlTextWriter)

        ' Call the base RenderContents method.

        ' Append some text to the Label.
        writer.Write("<BR>Experience Windows Server 2003 and Visual Studio .NET 2003.")
    End Sub
End Class

.NET Framework
Available since 1.1
Return to top