Welcome to the ASP.NET Core feedback portal. We’re happy you’re here! If you have feedback on how to improve the ASP.NET Core, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

2
Votes

Dear,

I get the error following error


An exception of type 'System.InvalidCastException' occurred in System.Private.CoreLib.dll but was not handled in user code
Object must implement IConvertible."

on the bold line of following code when trying to filter (on a EJ2 datagrid)


        [HttpPost]
        public ActionResult PostProduct([FromBody] DataManagerRequest dm)
        {

            var products = _context.Products.AsQueryable();

            DataOperations operation = new DataOperations();

            if (dm.Where != null && dm.Where.Count > 0) // Filtering
            {
                products = operation.PerformFiltering(products, dm.Where, dm.Where[0].Operator);  <<<<<<<<<<<<<<<<< THIS LINE GIVES THE ERROR
            }

            System.Text.Json.JsonSerializerOptions a = new System.Text.Json.JsonSerializerOptions
            {
                PropertyNamingPolicy = null,
            };

            return dm.RequiresCounts ? new JsonResult(new { result = products, count = products.Count() }, a) : new JsonResult(products, a);


        }


any ideas why I get this?