Freigeben über


CheckBox.Render-Methode

Diese Methode unterstützt die .NET Framework-Infrastruktur und ist nicht für die direkte Verwendung in Code bestimmt.

Zeigt CheckBox auf dem Client an.

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

Syntax

'Declaration
Protected Friend Overrides Sub Render ( _
    writer As HtmlTextWriter _
)
'Usage
Dim writer As HtmlTextWriter

Me.Render(writer)
protected internal override void Render (
    HtmlTextWriter writer
)
protected public:
virtual void Render (
    HtmlTextWriter^ writer
) override
protected void Render (
    HtmlTextWriter writer
)
protected internal override function Render (
    writer : HtmlTextWriter
)

Parameter

Beispiel

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<%@ Page language="VB" %>
<HTML>
  <HEAD>
    <title>Custom CheckBox - Render - VB.NET Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom CheckBox - Render - VB.NET Example</h3>
      <aspSample:CustomCheckBoxRender id="CheckBox1" runat="server" text="CheckBox1" />
    </form>
  </body>
</HTML>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page language="c#" %>
<HTML>
  <HEAD>
    <title>Custom CheckBox - Render - C# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom CheckBox - Render - C# Example</h3>

      <aspSample:CustomCheckBoxRender
        id="CheckBox1"
        runat="server"
        text="CheckBox1" />

    </form>
  </body>
</HTML>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page language="VJ#" %>
<HTML>
  <HEAD>
    <title>Custom CheckBox - Render - VJ# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom CheckBox - Render - VJ# Example</h3>

      <aspSample:CustomCheckBoxRender
        id="CheckBox1"
        runat="server"
        text="CheckBox1" />

    </form>
  </body>
</HTML>
Imports System.Web
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Controls
    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
    Public NotInheritable Class CustomCheckBoxRender
        Inherits System.Web.UI.WebControls.CheckBox

        Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
            ' Call the base class's Render method.
            MyBase.Render(writer)

            ' Render a BR HTML tag
            writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Br)

            ' Create and render a new Image Web control.
            Dim image As New System.Web.UI.WebControls.Image
            image.ID = "Image1"
            image.ImageUrl = "image.jpg"
            image.AlternateText = "Image for CheckBox1."
            image.RenderControl(writer)
        End Sub
    End Class
End Namespace
using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomCheckBoxRender : System.Web.UI.WebControls.CheckBox
    {
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
        // Call the base class's Render method.
        base.Render(writer);

        // Render a BR HTML tag
        writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Br);

        // Create and render a new Image Web control.
        System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
        image.ID = "Image1";
        image.ImageUrl = "image.jpg"; 
        image.AlternateText = "Image for CheckBox1.";
        image.RenderControl(writer);
        }
    }
}
package Samples.AspNet.JSL.Controls;

public class CustomCheckBoxRender
    extends System.Web.UI.WebControls.CheckBox
{
    protected void Render(System.Web.UI.HtmlTextWriter writer)
    {
        // Call the base class's Render method.
        super.Render(writer);
        // Render a BR HTML tag
        writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Br);
        // Create and render a new Image Web control.
        System.Web.UI.WebControls.Image image = 
            new System.Web.UI.WebControls.Image();
        image.set_ID("Image1");
        image.set_ImageUrl("image.jpg");
        image.set_AlternateText("Image for CheckBox1.");
        image.RenderControl(writer);
    } //Render
} //CustomCheckBoxRender

Plattformen

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

CheckBox-Klasse
CheckBox-Member
System.Web.UI.WebControls-Namespace

Weitere Ressourcen

CheckBox- und CheckBoxList-Webserver-Steuerelemente