Raises the PreRender event.
[Visual Basic]
Protected Overridable Sub OnPreRender( _
ByVal e As EventArgs _
)
[C#]
protected virtual void OnPreRender(
EventArgs e
);
[C++]
protected: virtual void OnPreRender(
EventArgs* e
);
[JScript]
protected function OnPreRender(
e : EventArgs
);
Parameters
- e
- An EventArgs object that contains the event data.
Remarks
This method notifies the server control to perform any necessary prerendering steps prior to saving view state and rendering content.
Example
[Visual Basic, C#, C++] 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.
[Visual Basic]
Protected Overrides Sub OnPreRender(e As EventArgs)
MyBase.OnPreRender(e)
End Sub
Private Sub PreRender_Handler(sender As Object, e As System.EventArgs)
_message = "Parent Text was changed by PreRender method"
End Sub
[C#]
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
}
private void PreRender_Handler(object sender,System.EventArgs e)
{
_message = "Parent Text was changed by PreRender method";
}
[C++]
protected:
void OnPreRender(EventArgs* e)
{
Control::OnPreRender(e);
}
private:
void PreRender_Handler(Object* /*sender*/,System::EventArgs* /*e*/)
{
_message = S"Parent Text was changed by PreRender method";
}
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
Control Class | Control Members | System.Web.UI Namespace | Page | Control Execution Lifecycle