When I try to filter a column of type DateTimeOffset, I get an error like: "System.InvalidCastException: Invalid cast "System.DateTime" to quot;System.DateTimeOffset"."
Please tell me how to solve this problem. Thank you!
2 Answers, 1 is accepted
0
Accepted
Daniel
Telerik team
answered on 11 Jun 2014, 07:05 AM
Hello,
This is not currently supported. The DataSourceRequest will always create a DateTime and not a DateTimeOffset. You should use a DateTime property in order to avoid the exception. If this is not possible in your scenario then I can suggest to convert the filter value to DateTimeOffset in the request filters e.g.
public static class Extensions
{
public static void MapFilters(this IList<IFilterDescriptor> filters, Action<FilterDescriptor> action)
descriptor.Value = new DateTimeOffset((DateTime)descriptor.Value);
}
});
}
Regards,
Daniel
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.