Page.PreInit 事件

定義

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

public:
 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.

適用於

另請參閱