Page.OnPreLoad(EventArgs) Page.OnPreLoad(EventArgs) Page.OnPreLoad(EventArgs) Page.OnPreLoad(EventArgs) Method

定義

在回傳資料載入頁面伺服器控制項之後,但在 PreLoad 事件之前,引發 OnLoad(EventArgs) 事件。Raises the PreLoad event after postback data is loaded into the page server controls but before the OnLoad(EventArgs) event.

protected:
 virtual void OnPreLoad(EventArgs ^ e);
protected virtual void OnPreLoad (EventArgs e);
abstract member OnPreLoad : EventArgs -> unit
override this.OnPreLoad : EventArgs -> unit
Protected Overridable Sub OnPreLoad (e As EventArgs)

參數

e
EventArgs EventArgs EventArgs EventArgs

包含事件資料的 EventArgsAn EventArgs that contains the event data.

備註

OnPreLoad載入使用者傳回的所有回傳資料之後,會呼叫方法。The OnPreLoad method is called after all postback data returned from the user is loaded. 在頁面生命週期的這個階段,會將初始化階段期間所建立之宣告控制項和控制項的檢視狀態資訊和回傳資料載入頁面的控制項中。At this stage in the page's life cycle, view-state information and postback data for declared controls and controls created during the initialization stage are loaded into the page's controls.

OnPreLoad方法中建立的控制項也會以檢視狀態和回傳資料載入。Controls created in the OnPreLoad method will also be loaded with view-state and postback data.

引發事件會透過委派叫用此事件處理常式。Raising an event invokes the event handler through a delegate. 如需詳細資訊, 請參閱處理和引發事件For more information, see Handling and Raising Events.

OnPreLoad 方法也允許衍生類別處理事件,而不用附加委派。The OnPreLoad method also allows derived classes to handle the event without attaching a delegate. 這是在衍生類別中處理事件的慣用技巧。This is the preferred technique for handling the event in a derived class.

給繼承者的注意事項

當在衍生類別中覆寫 OnPreLoad(EventArgs) 時,請確定呼叫基底類別的 OnPreLoad(EventArgs) 方法,使已註冊的委派能接收到事件。When overriding OnPreLoad(EventArgs) in a derived class, be sure to call the base class's OnPreLoad(EventArgs) method so that registered delegates receive the event.

適用於