Skip to main content
.NET Framework 4.6.2+
  • The page you are viewing does not exist in the .NET 8.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.v24.2.dll

Declaration

[DefaultValue(null)]
public string Criteria { get; set; }

Property Value

Type Default Description
String null

A String value that represents the filter criteria.

Remarks

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";

Note

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