Control.Load 事件

定义

当服务器控件加载到 Page 对象中时发生。

C#
public event EventHandler Load;

事件类型

示例

C#
// This is the constructor for a custom Page class. 
// When this constructor is called, it associates the Control.Load event,
// which the Page class inherits from the Control class, with the Page_Load
// event handler for this version of the page.
public MyPage()
{
   Load += new EventHandler(Page_Load);
}

注解

通知服务器控件执行设置为在每个页面请求上发生的任何处理步骤。 可以从此事件访问视图状态信息和 Web 窗体 POST 数据。 还可以访问页面控件层次结构中的其他服务器控件。

备注

如果在事件期间 Page_Load 在控件中设置自定义模板,则自定义模板中子控件的文本值将丢失。 发生这种情况的原因是窗体值已加载。

适用于

产品 版本
.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

另请参阅