Control.OnLoad(EventArgs) 方法

定義

引發 Load 事件。

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

參數

e
EventArgs

包含事件資料的 EventArgs 物件。

範例

// Override the OnLoad method to set _text to
// a default value if it is null.
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    if (_text == null)
        _text = "Here is some default text.";
}
Protected Overrides Sub OnLoad(ByVal e As EventArgs)
    MyBase.OnLoad(e)
    If _text Is Nothing Then
        _text = "Here is some default text."
    End If
End Sub

備註

ASP.NET 呼叫此方法來引發 Load 事件。 如果您要開發自訂控制項,您可以覆寫這個方法,以提供額外的處理。 如果您覆寫此方法,請呼叫基底控制項 OnLoad 的 方法來通知事件的訂閱者。

適用於

另請參閱