CheckBox.OnPreRender Method (EventArgs)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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

Registers client script for generating postback prior to rendering on the client if AutoPostBack is true.

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

Protected Friend Overrides Sub OnPreRender (
	e As EventArgs


Type: System.EventArgs

An EventArgs that contains the event data.

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<%@ Page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" >
    <title>Custom CheckBox - OnPreRender - VB.NET Example</title>
    <form id="Form1" method="post" runat="server">
      <h3>Custom CheckBox - OnPreRender - VB.NET Example</h3>
      <aspSample:CustomCheckBoxOnPreRender id="CheckBox1" runat="server" text="CheckBox1" />
Imports System.Web
Imports System.Security.Permissions

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

        Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
            ' Run the OnPreRender method on the base class.

            ' Display a LightGray BackColor for the CheckBox.
            Me.BackColor = System.Drawing.Color.LightGray
        End Sub 'OnPreRender
    End Class 'CustomCheckBoxOnPreRender
End Namespace

.NET Framework
Available since 1.1
Return to top