Completed
Last Updated: 14 Nov 2024 09:27 by ADMIN
Release 7.0.0
Pratik
Created on: 13 May 2024 06:47
Category: Grid
Type: Bug Report
4
Grid with OnRead event handler throws when a Grid column is bound to DateOnly and DateOnly? struct

I have the following Grid setup:

  • A Grid column is bound to DateOnly or DateOnly?
  • I have manually defined the OnRead event
  • Filter the DateOnly column, and to get the exception:
    • Serialize and deserialize the args.Request in the OnRead event handler with System.Text.Json OR
    • Page the Grid back and forth

Exception: System.ArgumentException: Operator 'IsEqualTo' is incompatible with operand types 'DateOnly?' and 'DateTime'

1 comment
ADMIN
Yanislav
Posted on: 25 Sep 2024 06:24

Hello everyone,

Upon reviewing the case, I believe the issue may not be directly related to the TelerikGrid component. The OnRead event arguments seem to return the correct DateOnly filter when the DatePicker value is changed.

> OnRead args.Request object

It seems the problem arises during the serialization and deserialization process, where the DateOnly value is being converted to DateTime.

> Same object value after the deserialization

This conversion changes the FilterDescriptor value type, causing a mismatch. Specifically, the ToDataSourceResult method expects filter descriptors for a DateOnly column, but after deserialization, a DateTime value is passed instead, which leads to the exception.

When the request object is passed directly to the ToDataSourceResult method without serialization, everything functions as expected. See: https://blazorrepl.telerik.com/cSaNmybd33AyNXbl39

Since this behavior appears to be related to the serialization process, I do not think it is not something we can resolve within the grid itself. With this in mind, I’ll go ahead and close this item.

Thank you for your understanding.

Regards,
Yanislav
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.