CheckBox.OnPreRender Method
.NET Framework 3.0
This method supports the .NET Framework 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.WebControlsAssembly: System.Web (in system.web.dll)
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page language="VJ#" %>
<!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 - VJ# Example</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom CheckBox - OnPreRender - VJ# Example</h3>
<aspSample:CustomCheckBoxOnPreRender
id="CheckBox1"
runat="server"
text="CheckBox1" />
</form>
</body>
</html>
package Samples.AspNet.JSL.Controls;
public class CustomCheckBoxOnPreRender
extends System.Web.UI.WebControls.CheckBox
{
protected void OnPreRender(System.EventArgs e)
{
// Run the OnPreRender method on the base class.
super.OnPreRender(e);
// Display a LightGray BackColor for the CheckBox.
this.set_BackColor(System.Drawing.Color.get_LightGray());
} //OnPreRender
} //CustomCheckBoxOnPreRender
Community Additions
ADD
Show: