Filtering after a partial Guid value not working on TelerikGrid

1 Answer 15 Views
Grid ListView
Tadas
Top achievements
Rank 1
Tadas asked on 08 May 2024, 10:44 AM

We are using a TelerikGrid which allows to filter various properties.

One of our properties is a name of Id, which is of Guid type.

Of course when we give a full Guid Id into the filter, the filter works, but as soon as we put a partial Guid value the filter breaks, because as expected, it cannot parse the given value.

Error: System.FormatException: Unrecognized Guid format.
   at System.Guid.GuidResult.SetFailure(ParseFailure failureKind)
   at System.Guid.TryParseGuid(ReadOnlySpan`1 guidString, GuidResult& result)
   at System.Guid..ctor(String g)

We have tried to convert guid value into string and then pass it into the filter, but it expects a Guid data type.

Is there a way to internally let the guid filter know, that he should expect a string value instead of Guid? Filtering after Guid doesn't really make sense, since user will most of the time just type a part of the full guid Id value.

 

Thank you for assistence!

 

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 13 May 2024, 07:47 AM

Hello Tadas,

The only data type, which supports a "contains" filtering is the string. So, you have two options:

  • Change the type of the Id property to string and call ToString() when creating new Guid values.
  • Bind the Grid with an OnRead event handler and implement custom filtering on your own without using ToDataSourceResult(). I don't think this option makes sense, because it's a lot more work than the previous one.

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Tags
Grid ListView
Asked by
Tadas
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or