Calendar.OnPreRender Method
.NET Framework 3.0
Raises the PreRender event.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The OnPreRender method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Notes to Inheritors: When overriding OnPreRender in a derived class, be sure to call the base class's OnPreRender method so that registered delegates receive the event.The following code example demonstrates how to override the OnPreRender method so that it always displays a three-point border in a custom Calendar server control.
<%@ 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 Calendar - OnPreRender - VJ# Example</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<h3>Custom Calendar - OnPreRender - VJ# Example</h3>
<aspSample:CustomCalendarOnPreRender
id="Calendar1"
runat="server" />
</form>
</body>
</html>
package Samples.AspNet.JSL.Controls;
public class CustomCalendarOnPreRender
extends System.Web.UI.WebControls.Calendar
{
protected void OnPreRender(System.EventArgs e)
{
// Run the OnPreRender method on the base class.
super.OnPreRender(e);
// Display the Calendar with a 3 point border.
this.set_BorderWidth(System.Web.UI.WebControls.Unit.Point(3));
} //OnPreRender
} //CustomCalendarOnPreRender
Community Additions
ADD
Show: