Control.OnPreRender(EventArgs) 方法

定义

引发 PreRender 事件。

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)

参数

e
EventArgs

包含事件数据的 EventArgs 对象。

示例

// 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

注解

ASP.NET 调用此方法以引发 PreRender 事件。 如果要开发自定义控件,可以重写此方法以提供其他处理。 如果重写此方法,请调用基控件的 OnPreRender 方法以通知事件订阅者。

适用于

另请参阅