Control.OnUnload(EventArgs) 方法

定义

引发 Unload 事件。Raises the Unload event.

protected:
 virtual void OnUnload(EventArgs ^ e);
protected public:
 virtual void OnUnload(EventArgs ^ e);
protected virtual void OnUnload (EventArgs e);
protected internal virtual void OnUnload (EventArgs e);
abstract member OnUnload : EventArgs -> unit
override this.OnUnload : EventArgs -> unit
Protected Overridable Sub OnUnload (e As EventArgs)
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.

适用于

另请参阅