This question is locked. New answers and comments are not allowed.
I was having trouble finding a solution to filtering on null via code. I found the solution and wish to share that with the community as I could not find the solution here.
I have cliped out non-relevent code. The filter object that is created above will allow the correct filtering to happen, but using the following will NOT work.
(WONT WORK)
| ... |
| private IDataFieldDescriptor DataMember |
| ... |
| public BuildFilter() |
| { |
| ... |
| ColumnFilterDescriptor filter = new ColumnFilterDescriptor(DataMember); |
| if (OnlyNulls) |
| { |
| filter.FieldFilter.FilterDescriptors.Add( |
| new FilterDescriptor(DataMember.DataMemberBinding.Path.Path, FilterOperator.IsEqualTo, (DateTime?)null)); |
| } |
| ... |
| } |
I have cliped out non-relevent code. The filter object that is created above will allow the correct filtering to happen, but using the following will NOT work.
(WONT WORK)
| ... |
| filter.FieldFilter.Filter1.Operator = FilterOperator.IsEqualTo; |
| filter.FieldFilter.Filter1.Value = (DateTime?)null; |
| ... |