Control.OnLoad(EventArgs) Control.OnLoad(EventArgs) Control.OnLoad(EventArgs) Control.OnLoad(EventArgs) Method

定義

引發 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 EventArgs 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.

適用於

另請參閱