Control.Load 事件

定义

当服务器控件加载到 Page 对象中时发生。Occurs when the server control is loaded into the Page object.

public:
 event EventHandler ^ Load;
public event EventHandler Load;
member this.Load : EventHandler 
Public Custom Event Load As 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

注解

通知服务器控件执行任何设置为在每个页面请求上进行的处理步骤。Notifies the server control to perform any processing steps that are set to occur on each page request. 您可以通过此事件访问视图状态信息和 Web 窗体发布数据。You can access view state information and Web form POST data from this event. 您还可以访问页的控件层次结构中的其他服务器控件。You can also access other server controls within the page's control hierarchy.

备注

如果在 Page_Load 事件期间在控件中设置了自定义模板,则自定义模板中子控件的文本值将会丢失。If you set a custom template in a control during the Page_Load event, the text values of child controls in the custom template will be lost. 出现这种情况是因为已经加载了窗体值。This occurs because the form values have already been loaded.

适用于

另请参阅