ObjectDataSourceView.Filtering 事件

定義

在篩選作業之前發生。Occurs before a filter operation.

public:
 event System::Web::UI::WebControls::ObjectDataSourceFilteringEventHandler ^ Filtering;
public event System.Web.UI.WebControls.ObjectDataSourceFilteringEventHandler Filtering;
member this.Filtering : System.Web.UI.WebControls.ObjectDataSourceFilteringEventHandler 
Public Custom Event Filtering As ObjectDataSourceFilteringEventHandler 

事件類型

ObjectDataSourceFilteringEventHandler

備註

處理 Filtering 事件,以便在控制項執行篩選作業之前,對篩選參數值執行驗證作業 ObjectDataSourceHandle the Filtering event to perform validation operations on filter parameter values before the ObjectDataSource control performs a filter operation. 您可以 Select 將物件的屬性設定為,以取消作業 Cancel ObjectDataSourceFilteringEventArgs trueYou can cancel the Select operation by setting the Cancel property of the ObjectDataSourceFilteringEventArgs object to true. 只有在設定屬性時,才會引發事件 FilterExpressionThe event is raised, only if the FilterExpression property is set.

如需如何處理事件的詳細資訊,請參閱 處理和引發事件For more information about how to handle events, see Handling and Raising Events.

重要

您應該驗證您從用戶端收到的任何篩選參數值。You should validate any filter parameter value that you receive from the client. 執行時間只會將參數值替換成篩選運算式,並將它套用至 DataView 方法所傳回的物件 SelectThe runtime simply substitutes the parameter value into the filter expression and applies it to the DataView object that is returned by the Select method. 如果您使用 FilterExpression 屬性做為安全性量值來限制傳回的專案數,您必須在進行篩選之前驗證參數值。If you are using the FilterExpression property as a security measure to limit the number of items that are returned, you must validate the parameter values before the filtering occurs.

適用於

另請參閱