CheckBox.OnPreRender-Methode
Diese Methode unterstützt die .NET Framework-Infrastruktur und ist nicht für die direkte Verwendung in Code bestimmt.
Registriert ein Clientskript für das Generieren des Postbacks vor der Wiedergabe auf dem Client, wenn AutoPostBack gleich true ist.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
Syntax
'Declaration
Protected Friend Overrides Sub OnPreRender ( _
e As EventArgs _
)
'Usage
Dim e As EventArgs
Me.OnPreRender(e)
protected internal override void OnPreRender (
EventArgs e
)
protected public:
virtual void OnPreRender (
EventArgs^ e
) override
protected void OnPreRender (
EventArgs e
)
protected internal override function OnPreRender (
e : EventArgs
)
Parameter
- e
Eine Instanz der EventArgs-Klasse, die die Ereignisdaten enthält.
Beispiel
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls" Assembly="Samples.AspNet.VB" %>
<%@ Page language="VB" %>
<HTML>
<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>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<%@ Page language="c#" %>
<HTML>
<HEAD>
<title>Custom CheckBox - OnPreRender - C# Example</title>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom CheckBox - OnPreRender - C# Example</h3>
<aspSample:CustomCheckBoxOnPreRender
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 - 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>
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
using System.Web;
using System.Security.Permissions;
namespace Samples.AspNet.CS.Controls
{
[AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
public class CustomCheckBoxOnPreRender : System.Web.UI.WebControls.CheckBox
{
protected override void OnPreRender(System.EventArgs e)
{
// Run the OnPreRender method on the base class.
base.OnPreRender(e);
// Display a LightGray BackColor for the CheckBox.
this.BackColor = System.Drawing.Color.LightGray;
}
}
}
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
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