Control.OnPreRender(EventArgs) 方法

定義

引發 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 物件。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.

適用於

另請參閱