RadzenDataGridColumn enum filter not working without single quotes

I'm using a custom data grid column filter template with dropdown that is an Enum type. The filter string for LoadDataArgs looks like 'Status eq CheckedOut'. My web api throws an error trying to map CheckedOut as a property and not an enum value. If I surround CheckedOut in single quotes, it works just fine.

According to OData specifications, the enum value in the filter string should be surrounded by single quotes. Is this custom code I need to write to do this from in the blazor app or does the data grid component provide some sort of extension method to do this?

Status is the property on the model for the data grid. CheckedOut is the Enum name.

Here's the column component code.

<RadzenDataGridColumn TItem="StudyVersionViewModel" Property="@nameof(StudyVersionViewModel.Status)" Title="Status" FilterValue="@FilteredStatus">
                        <RadzenDropDown @bind-Value="@FilteredStatus" Style="width:100%;" TValue="VersionStatus?"
                                        AllowClear="true" TextProperty="DisplayName" ValueProperty="Status" />

Request query string

Other filter types (string, int) work just fine.

Let me know if you need to know anything else.

Hi @Griff,

Fix for this will be released later today!

1 Like

Thanks for the quick reply. Looking forward to the update!

It’s already released.

Thanks, Enchev for the update. Which nuget package do I need to update? I updated to latest Radzen.Blazor nuget package (4.7.10), but I'm still seeing the issue. Do I need to change my code in any way for this fix to know the type of the column?

Yes, this is the package and here is the fix:

You can attach the source code of Radzen.Blazor to your project to debug why it fails.

Thanks, @enchev. I see the Filter from LoadDataArgs has not changed.

The ToODataFilterString extension method is still returning the same string as well.

Even though I see that in the ColumnsCollection, the FilterPropertyType IsEnum flag is set to true.

Any ideas?

Maybe if it's nullable enum this will help:

Have you tried to debug it as I suggested?

Ah, I see. Let me try

@enchev I found the problem. The FilterPropertyType is also coming back as numeric for the Enum type, so the IsNumeric condition is being met first. When I switch the conditions locally, the Enum filter was returned correctly, and my API call went through successfully.


The IsNumeric method is returning true because GetTypeCode returns Int32 for Enum.

See this https://stackoverflow.com/questions/124411/using-net-how-can-i-determine-if-a-type-is-a-numeric-valuetype/31709198#31709198

Thanks @Griff! We will publish update tomorrow!

1 Like

@enchev What's the status of this fix? I see 4.7.11 was released with an OData enum filtering fix. Does that address this issue?

Hey @Griff,

You can monitor commits and what is included in the release:

@enchev I see thanks. Looks like it is addressed. Thanks. I'll verify.

@enchev Verified the issue has been fixed. :+1: