Control.OnUnload(EventArgs) 方法

定義

引發 Unload 事件。Raises the Unload event.

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

參數

e
EventArgs

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

範例

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

備註

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

適用於

另請參閱