Skip to main content
A newer version of this page is available. .

How to: Change the Prefilter's Criteria in Code

  • 2 minutes to read

The following example shows how to filter an ASPxPivotGrid control's underlying data source using the Prefilter. The filter selects records that contain 'USA' or 'UK' strings in the Country field.

View Example

using System;
using System.Web.UI;

namespace ChangingPrefilterCriteria {
    public partial class _Default : Page {
        protected void Page_Load(object sender, EventArgs e) {
            ASPxPivotGrid1.Prefilter.CriteriaString = "[" + fieldCountry.PrefilterColumnName + 
                "] == 'UK' OR [" + fieldCountry.PrefilterColumnName + "] == 'USA'";
        }
    }
}