CheckBox.OnPreRender Method (EventArgs)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com 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
)

Parameters

e
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"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>Custom CheckBox - OnPreRender - VB.NET Example</title>
  </head>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom CheckBox - OnPreRender - VB.NET Example</h3>
      <aspSample:CustomCheckBoxOnPreRender 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 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.
            MyBase.OnPreRender(e)

            ' 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
Show: