Generated OData URI syntax not as expected

Hi,

I'm trying to connect a RadzenDataGrid (hosted in Blazor WASM) to an OData API (built by me, but using standard Microsoft.AspnetCore.OData query processing).

I'm using Radzen.ODataExtensions.GetODataUri() in the Blazor client to build the request to the API and this works fine for basic requests but if I add a column filter, e.g. 'Contains "abc"', the request fails because the API can't parse it. This appears to be because the generated URI formats the filter condition in what looks to me like C# syntax, rather than the OData syntax.

Here's an example generated URI (I've URL-decoded it for legibility)

https://localhost:44308/OData/Job?$filter=(Title+==+null+?+''+:+Title).Contains('abc')&$top=10&$skip=0&$count=true

And here's what I would have been expecting (this one can be processed by the OData API)

https://localhost:44308/Job?$Filter=contains(title, 'abc')&$top=10&$skip=0&$count=true

I feel like I'm missing something obvious because I haven't found anyone else talking about this. Is there a config option somewhere that would switch this the extension method between C-style and OData-style syntax? Or maybe there's another method that I should be using?

Aha! Good old rubber duck debugging - I've been looking at this for a while but as soon as I posted the above I realised that the C-style filter string wasn't being generated by GetODataUri() at all, it had been passed in from the grid's LoadDataArgs.Filter property.

So it looks like my question should be: is there a way to get an OData-style filter string from the grid's LoadDataArgs?

Check this thread:

That's it exactly! Thanks, my search terms were clearly rubbish.

I was using AsODataEnumerable() in one place but the list property itself was typed IEnumerable<T> which I suppose is what the grid was seeing.

Having changed the property to type ODataEnumerable<T> and using that to feed the grid I now have proper OData filter strings. Great!

image

Thanks again.