We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid not supporting double/decimal fields

I am using a grid component and the data source is a list of a class, in which some of the fields have to be double or decimal.  However, whenever I try to use these fields I get the following error in the Chrome console:

Error: Newtonsoft.Json.JsonSerializationException: Error converting value 0.01 to type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]'. Path '', line 1, position 4. ---> System.ArgumentException: Could not cast or convert from System.Double to System.Collections.Generic.Dictionary`2[System.String,System.Object].
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Syncfusion.EJ2.Blazor.BaseComponent.GetObject(Dictionary`2 Data, Type ModelType)
   at Syncfusion.EJ2.Blazor.Grids.GridTemplates.BuildRenderTree(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__5_0(RenderTreeBuilder builder)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.ProcessRenderQueue()

Not sure if it matters, but I am specifying a row template and was hoping to use aggregates but I at the moment I had to make a compatible class which converts all the double/decimal values to strings.

1 Reply

Vignesh Natarajan July 31, 2019 03:45 PM UTC

Hi Dominick,  

Thanks for contacting Syncfusion forum.  

Query: “I am using a grid component and the data source is a list of a class, in which some of the fields have to be double or decimal. 

As per your suggestion we have prepared a sample using Double property with Row Template and we are not able to reproduce the reported issue at our end. Kindly refer the below link for the sample  


If you are still facing the issue, kindly share additional details regarding the issue you are facing. 

  1. Share your model details.
  2. Share the Grid rendering code.
  3. Are you facing issue during the initial rendering or during certain action.
  4. Share your Syncfusion Nuget version.
  5. If possible try to reproduce the reported issue in provided sample.
  6. Kindly ensure that you have referred the latest version of Nuget , script and Css files.  

Requested details will be helpful for us to validate the reported issue at our end and provide the solution as early as possible.  

Regards, 
Vignesh Natarajan. 

Loader.
Live Chat Icon For mobile
Up arrow icon