Control.OnPreRender(EventArgs) Control.OnPreRender(EventArgs) Control.OnPreRender(EventArgs) Control.OnPreRender(EventArgs) Method

定义

引发 PreRender 事件。Raises the PreRender event.

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

参数

e
EventArgs EventArgs EventArgs EventArgs

包含事件数据的 EventArgs 对象。An EventArgs object that contains the event data.

示例

// 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事件。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. 如果重写此方法,请调用基控件的OnPreRender方法以通知订阅者事件。If you override this method, call the base control's OnPreRender method to notify subscribers to the event.

适用于

另请参阅