This is a migrated thread and some comments may be shown as answers.

[Solved] Grouping problem when values is null

0 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tuinel
Top achievements
Rank 1
Tuinel asked on 06 Oct 2011, 04:52 PM
There is problem with grouping when values is null ? I got error

System.InvalidOperationExceptionThe cast to value type 'Double' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type.

There is some way to do this. In database this fields is nullable datetime. On grid i show them like:

 
columns.Bound(c => c.TestNullData).Format("{0:d}");


Can i do something to fix this ?


PS. In Model looks like this.
[Display(Name = "RozliczeniaDataZaplaty", ResourceType = typeof(Translate))]
[DataType(DataType.Date, ErrorMessageResourceName = "RozliczeniaDataZaplaty_Error_DataType_Data", ErrorMessageResourceType = typeof(Translate))]
public virtual DateTime? TestNullData { get; set; }

Tags
Grid
Asked by
Tuinel
Top achievements
Rank 1
Share this question
or