共用方式為


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 的 方法來通知事件的訂閱者。

適用於

另請參閱