Uređivanje

Dijeli putem


Control.OnPreRender(EventArgs) Method

Definition

Raises the PreRender event.

protected:
 virtual void OnPreRender(EventArgs ^ e);
protected public:
 virtual void OnPreRender(EventArgs ^ e);
protected virtual void OnPreRender (EventArgs e);
protected internal virtual void OnPreRender (EventArgs e);
abstract member OnPreRender : EventArgs -> unit
override this.OnPreRender : EventArgs -> unit
Protected Overridable Sub OnPreRender (e As EventArgs)
Protected Friend Overridable Sub OnPreRender (e As EventArgs)

Parameters

e
EventArgs

An EventArgs object that contains the event data.

Examples

// 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.";
}
' Override the OnPreRender method to set _message to
' a default value if it is null.
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
    MyBase.OnPreRender(e)
    If _message Is Nothing Then
        _message = "Here is some default text."
    End If
End Sub

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

See also