使用英语阅读

通过


Control.OnUnload(EventArgs) 方法

定义

引发 Unload 事件。

C#
protected virtual void OnUnload(EventArgs e);
C#
protected internal virtual void OnUnload(EventArgs e);

参数

e
EventArgs

包含事件数据的 EventArgs 对象。

示例

C#
// 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.";
}

注解

ASP.NET 调用此方法来引发 Unload 事件。 如果要开发自定义控件,则可以替代此方法以提供其他处理。 如果重写此方法,请调用基控件的 OnUnload 方法来通知事件的订阅者。

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

另请参阅