The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
The page you are viewing does not exist in the .NET Standard 2.0+ platform documentation. This link will take you to the parent topic of the current section.

XpoDataSource.Criteria Property

Gets or sets the string representation of criteria used to filter persistent objects to be retrieved by the data source control.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.1.dll


public string Criteria { get; set; }
Public Property Criteria As String

Property Value

Type Description

A String value that represents the filter criteria.


The string format is the same as in the CriteriaOperator.Parse method's stringCriteria parameter. You can add question marks to the string to indicate the position of parameter values. When the expression is evaluated, the question marks are replaced with parameter values. To provide parameter values, use the XpoDataSource.CriteriaParameters property.

The following code snippet demonstrates two equivalent criteria applied to the XpoDataSource1 and XpoDataSource2 data source controls.

XpoDataSource1.Criteria = "[Category] = 'Saloon' AND [Price] < 100000";
XpoDataSource2.Criteria = "[Category] = ? AND [Price] < ?";
XpoDataSource2.CriteriaParameters.Add("Category", "Saloon");
XpoDataSource2.CriteriaParameters.Add("Price", "100000");

The following criteria are identical because they refer to the same parameter values.

XpoDataSource2.Criteria = "[Category] = ? AND [Price] < ?";
XpoDataSource2.Criteria = "[Category] = ?Category AND [Price] < ?Price";

Criteria can only be built on persistent properties. If you change the Criteria property's value or change any of the criteria parameters available via the XpoDataSource.CriteriaParameters property, the data source is refreshed immediately.

See Also