Control.Load 事件

定义

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

public:
 event EventHandler ^ Load;
public event EventHandler Load;
member this.Load : EventHandler 
Public Custom Event Load As EventHandler 

事件类型

EventHandler

示例

// 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);
}
' 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 Sub New()
   AddHandler Load, AddressOf Page_Load
End Sub

注解

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

备注

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

适用于

另请参阅