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.

適用於

另請參閱