Control.OnUnload(EventArgs) Control.OnUnload(EventArgs) Control.OnUnload(EventArgs) Control.OnUnload(EventArgs) Method

定義

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

適用於

另請參閱