TemplatePagerField.OnPagerCommand(DataPagerCommandEventArgs) 方法

定義

引發 PagerCommand 事件。Raises the PagerCommand event.

protected:
 virtual void OnPagerCommand(System::Web::UI::WebControls::DataPagerCommandEventArgs ^ e);
protected virtual void OnPagerCommand (System.Web.UI.WebControls.DataPagerCommandEventArgs e);
abstract member OnPagerCommand : System.Web.UI.WebControls.DataPagerCommandEventArgs -> unit
override this.OnPagerCommand : System.Web.UI.WebControls.DataPagerCommandEventArgs -> unit
Protected Overridable Sub OnPagerCommand (e As DataPagerCommandEventArgs)

參數

e
DataPagerCommandEventArgs

事件資料。The event data.

例外狀況

沒有 PagerCommand 事件的處理常式。There is no handler for the PagerCommand event.

備註

PagerCommand按一下TemplatePagerField物件中的按鈕時, 就會引發事件。The PagerCommand event is raised when a button is clicked in the TemplatePagerField object. 這可讓您在每次發生此事件時執行自訂常式。This enables you to perform a custom routine whenever this event occurs.

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

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

給繼承者的注意事項

當您在OnPagerCommand(DataPagerCommandEventArgs)衍生類別中覆寫時, 請呼叫基類OnPagerCommand(DataPagerCommandEventArgs)的方法, 讓已註冊的委派能接收事件。When you override OnPagerCommand(DataPagerCommandEventArgs) in a derived class, call the base class' OnPagerCommand(DataPagerCommandEventArgs) method so that registered delegates receive the event.

適用於

另請參閱