GridDataControl allows you to create filters and apply them from code behind in two ways,
You can apply filter to a particular column by adding FilterPredicate to the Filters of that VisibleColumn using Filters.Add method.
FilterPredicate class has the following properties.
You can set any Predicate Type and conditions available in Predicate class to a VisibleColumn’s Filter. Refer the following code example, where column filter is applied to the “Companyname” column with FilterType “Equals”, FilterValue “Syncfusion”, and PredicateType as “And”.
Following snapshots illustrates the effect of above code in GridDataControl
GridDataControl provides support to achieve view filtering by setting the GridDataControl.Model.View.Filter property. FilterRecords method filters the data that contains the filterText value. To filter a column assign, FilterRecords method to GridDataControl.Model.View.Filter predicate. Refer the following code.
Following snapshot illustrates the effect of above code in GridDataControl
In this example, the GridDataControl contains EmployeeDetails as ItemsSource. FilterRecords method is used to filter the filterText (filterText is the text entered in the text box in the view). FilterRecords is assigned to dataGrid.Model.View.Filter predicate to filter the “EmpName” column. Here the EmpName column is filtered using a search string “raj”.
This page will automatically be redirected to the sign-in page in 10 seconds.