Control.OnLoad(EventArgs) 方法

定義

引發 Load 事件。Raises the Load event.

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

參數

e
EventArgs

包含事件資料的 EventArgs 物件。The EventArgs object that contains the event data.

範例

// 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 事件。ASP.NET calls this method to raise the Load event. 如果您開發的是自訂控制項,您可以覆寫這個方法,以提供額外的處理。If you are developing a custom control, you can override this method in order to provide additional processing. 如果您覆寫這個方法,請呼叫基底控制項的 OnLoad 方法,以通知訂閱者事件。If you override this method, call the base control's OnLoad method to notify subscribers to the event.

適用於

另請參閱