I have a AspxGridview with a Filter field as:
<dxwgv:GridViewDataComboBoxColumn Caption="Has Duplicates FieldName="NumberOfDuplicates" VisibleIndex="6">
<PropertiesComboBox ValueType="System.Int32"><Items>
<dxe:ListEditItem Text="Yes" value="999"
>
<dxe:ListEditItem Text="No" value="0"
/>
</Items></PropertiesComboBox></dxwgv:GridViewDataComboBoxColumn>
The field name NumberOfDuplicates is a integer which can have a value of 0 to whatever. I have set up a criteria in the code behind as
protected void grvPublicationList_ProcessColumnAutoFilter(object sender, ASPxGridViewAutoFilterEventArgs e)
{
if (e.Column == grvPublicationList.Columns["NumberOfDuplicates"] )
{
if (e.Value == "0")
{
e.Criteria = new BinaryOperator("NumberOfDuplicates", 0, BinaryOperatorType.Equal);
}
else
{
e.Criteria = new BinaryOperator("NumberOfDuplicates", 1, BinaryOperatorType.GreaterOrEqual);
}
}
}
So if the user selects No, the grid is filtered to find all the records with 0 duplicates. (Don't know why but all the 0's get replaced with "No" in that coloumn).
And if the user selects Yes, the grid is filtered with all records that have 1 or more. The filtering is working fine.
However, because I have initially set the ListEditItem Yes with a value of 999 (I know there are no records with 999 NumberOfDuplicates), the selected value in GridViewDataComboBoxColumn becomes a 1 or whatever I have put into the right operand of e.Criteria instead of Yes.
My question is how can I apply this filter and still keep the selected value to be Yes in the GridViewDataComboBoxColumn and still display the actual number of duplicates for the records in that coloumn.