I have a GridView where one column is bound to an object property containing a nullable integer. I set SortExpression to the name of the property, and sorting works perfectly as long as all rows contain a value. If any rows contain null, however, I get an exception:
System.InvalidOperationException : Failed to compare two elements in the array. Object reference not set to an instance of an object.
How do I customize the sorting or comparison logic to handle the null case?