ObjectDataSource.Filtering ObjectDataSource.Filtering ObjectDataSource.Filtering ObjectDataSource.Filtering Event


执行筛选操作前发生。Occurs before a filter operation.

 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 


处理事件, 在ObjectDataSource控件执行筛选器操作之前对筛选器参数值执行验证操作。 FilteringHandle the Filtering event to perform validation operations on filter parameter values before the ObjectDataSource control performs a filter operation. 您可以通过将的Cancel ObjectDataSourceFilteringEventArgs属性设置为来true取消所选操作。You can cancel the selected operation by setting the Cancel property of the ObjectDataSourceFilteringEventArgs to true. 仅当FilterExpression设置了属性时才引发事件。The event is raised only if the FilterExpression property is set.

事件委托ObjectDataSourceView ObjectDataSourceView.Filtering给与ObjectDataSource控件相关联的事件。 ObjectDataSource.FilteringThe ObjectDataSource.Filtering event delegates to the ObjectDataSourceView.Filtering event of the ObjectDataSourceView that is associated with the ObjectDataSource control.


应该验证从客户端接收的任何筛选器参数值。You should validate any filter parameter value that you receive from the client. 运行时只需将参数值替换为筛选表达式, 并将其DataSet应用于DataTable Select方法返回的或对象。The runtime simply substitutes the parameter value into the filter expression and applies it to the DataSet or DataTable 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.

有关如何处理事件的详细信息, 请参阅处理和引发事件For more information about how to handle events, see Handling and Raising Events.