Page.PreInit Page.PreInit Page.PreInit Page.PreInit Event


在頁面初始化之前發生。Occurs before page initialization.

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


此事件可讓您檢查頁面要求,例如是否載入網頁回傳的回應中的條件。This event enables you to check conditions of the page request, such as whether the page is being loaded in response to a postback. 您也可以檢查設定檔屬性的值。You can also check the values of profile properties.

事件可讓您設定值,可稍後在頁面生命週期。The event enables you to set values that are used later in the page life cycle. 您可以動態設定主版頁面或所要求的頁面、 佈景主題和建立動態控制項。You can dynamically set a master page or a theme for the requested page, and create dynamic controls.

如需有關如何PreInit融入 ASP.NET 生命週期的事件,請參閱 < ASP.NET 網頁生命週期概觀For more information about how the PreInit event fits into the ASP.NET life cycle, see ASP.NET Page Life Cycle Overview.