Control.OnPreRender(EventArgs) Method

Definition

Raises the PreRender event.

C#
protected virtual void OnPreRender(EventArgs e);
C#
protected internal virtual void OnPreRender(EventArgs e);

Parameters

e
EventArgs

An EventArgs object that contains the event data.

Examples

C#
// Override the OnPreRender method to set _message to
// a default value if it is null.
protected override void OnPreRender(EventArgs e)
{
    base.OnPreRender(e);
    if (_message == null)
        _message = "Here is some default text.";
}

Remarks

ASP.NET calls this method to raise the PreRender event. If you are developing a custom control, you can override this method in order to provide additional processing. If you override this method, call the base control's OnPreRender method to notify subscribers to the event.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also