Export (0) Print
Expand All

Control.OnPreRender Method

Raises the PreRender event.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)

protected internal virtual void OnPreRender (
	EventArgs e
protected void OnPreRender (
	EventArgs e
protected internal function OnPreRender (
	e : EventArgs
Not applicable.



An EventArgs object that contains the event data.

This method notifies the server control to perform any necessary prerendering steps prior to saving view state and rendering content.

The following example overrides the OnPreRender method in a custom server control. When the custom control is requested from an ASP.NET page, during the PreRender stage of page processing, OnPreRender method is called and the custom PreRender_Handler method sends its _message property value, "Parent Text was changed by PreRender method", to the page.

protected override void OnPreRender(EventArgs e)
private void PreRender_Handler(object sender,System.EventArgs e)
   _message = "Parent Text was changed by PreRender method";

protected void OnPreRender(EventArgs e)
} //OnPreRender

private void PreRender_Handler(Object sender, System.EventArgs e)
    _message = "Parent Text was changed by PreRender method";
} //PreRender_Handler

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

© 2015 Microsoft