RadzenGrid binary operator not defined

Hi,

I'm having some trouble with filtering in the RadzenGrid in Blazor (Server).

For the most part the grid works correctly, it's when I'm passing in a list of Dynamic Objects the filtering throws the error:

warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: The binary operator Equal is not defined for the types 'System.Object' and 'System.DateTime'.
System.InvalidOperationException: The binary operator Equal is not defined for the types 'System.Object' and 'System.DateTime'.
   at System.Linq.Expressions.Expression.GetEqualityComparisonOperator(ExpressionType binaryType, String opName, Expression left, Expression right, Boolean liftToNull)
   at System.Linq.Expressions.Expression.Equal(Expression left, Expression right, Boolean liftToNull, MethodInfo method)
   at System.Linq.Expressions.Expression.Equal(Expression left, Expression right)
   at System.Linq.Dynamic.Core.Parser.ExpressionHelper.GenerateEqual(Expression left, Expression right)
   at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseComparisonOperator()
   at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLogicalAndOrOperator()
   at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseIn()
   at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseAndOperator()
   at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseOrOperator()
   at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLambdaOperator()
   at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseNullCoalescingOperator()
   at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseConditionalOperator()
   at System.Linq.Dynamic.Core.Parser.ExpressionParser.Parse(Type resultType, Boolean createParameterCtor)
   at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values)
   at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, Type itType, Type resultType, String expression, Object[] values)
   at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Where(IQueryable source, ParsingConfig config, String predicate, Object[] args)
   at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Where[TSource](IQueryable`1 source, ParsingConfig config, String predicate, Object[] args)
   at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Where[TSource](IQueryable`1 source, String predicate, Object[] args)
   at Radzen.Blazor.RadzenGrid`1.get_View()
   at Radzen.PagedDataBoundComponent`1.get_PagedView()
   at Radzen.Blazor.RadzenGrid`1.BuildRenderTree(RenderTreeBuilder __builder)
   at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

The functionality allows users to great their own data views. That data gets stored in a custom dynamic object (inherits System.Dynamic.DynamicObject, and IDictionary). The data loads correctly, and I set up the Grids Type and Format to make sure the correct filters were being added. When applying filters is doesn't know what the data types are. I debugged the data and it says it's the correct types through visual studio.

Is there a way I could tell the filters what datatype they need to convert the data to before filtering? Or an event / method I could override that would let me convert the data types myself before the filter?

Thanks!

Hi @Stephen_Velluto,

No, the Radzen DataGrid does not have a feature which converts data types.

You can try using the LoadData event where the developer performs the filtering with their own code.

Hi @korchev,

Thanks for the help. The LoadData method worked once I connected up the Filter string to our other expression system which was already handling our dynamic structures.

One thing though, I had trouble with the method at first as there were no records loading. When I added the Count I was getting data, but it didn't say anywhere, that I found, that Count was required for LoadData to work. So maybe there should be a note in the example you sent me.

Thanks.