This example shows how to apply a filter to display orders created within a specific date range (between specific dates).
DateTime date1 = new DateTime(2011, 1, 1);
DateTime date2 = new DateTime(2011, 7, 1);
CriteriaOperator filter = GroupOperator.Combine(GroupOperatorType .And,
new BinaryOperator("OrderDate", date1, BinaryOperatorType.Greater),
new BinaryOperator("OrderDate", date2, BinaryOperatorType.Less));
ASPxGridView1.FilterExpression = filter.ToString();
Dim date1 As New DateTime(2011, 1, 1)
Dim date2 As New DateTime(2011, 7, 1)
Dim filter As CriteriaOperator = GroupOperator.Combine(GroupOperatorType.And, _
New BinaryOperator("OrderDate", date1, BinaryOperatorType.Greater), _
New BinaryOperator("OrderDate", date2, BinaryOperatorType.Less))
ASPxGridView1.FilterExpression = filter.ToString()
Alternatively, you can use CriteriaOperator.Parse as shown below.
CriteriaOperator filter =
CriteriaOperator.Parse("[OrderDate] > ? And [OrderDate] < ?", date1, date2);
ASPxGridView1.FilterExpression = filter.ToString();
Dim filter As CriteriaOperator = _
CriteriaOperator.Parse("[OrderDate] > ? And [OrderDate] < ?", date1, date2)
ASPxGridView1.FilterExpression = filter.ToString()