The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I am trying to have a grid column show an image and, when double-clicking, use in-cell editing to allow removing of the image. It works fine if there is no image already uploaded but crashes on editing when an image has been
WASM: Newtonsoft.Json.JsonReaderException: Error parsing comment. Expected: *, got 9. Path '', line 1, position 1.
WASM: at Newtonsoft.Json.JsonTextReader.ParseComment (System.Boolean setToken) <0x54e02c8 + 0x0009a> in <2073514815234917a5e8f91b0b239405>:0
WASM: at Newtonsoft.Json.JsonTextReader.ReadAsBytes () <0x42b90b0 + 0x0024c> in <2073514815234917a5e8f91b0b239405>:0
WASM: at Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) <0x3f18a60 + 0x00134> in <2073514815234917a5e8f91b0b239405>:0
WASM: at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) <0x3d67400 + 0x001ac> in <2073514815234917a5e8f91b0b239405>:0
WASM: at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) <0x3d63d80 + 0x000a4> in <2073514815234917a5e8f91b0b239405>:0
WASM: at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) <0x3d636b0 + 0x0000e> in <2073514815234917a5e8f91b0b239405>:0
WASM: at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) <0x3d397f8 + 0x00066> in <2073514815234917a5e8f91b0b239405>:0
WASM: at Syncfusion.EJ2.Blazor.BaseComponent.ChangeType (System.Object value, System.Type conversionType, System.Boolean isClientChange) <0x6a552b0 + 0x00484> in <ee00940cee7542adb6b389ec86003d4f>:0
WASM: at Syncfusion.EJ2.Blazor.BaseComponent.GetObject (System.Collections.Generic.Dictionary`2[TKey,TValue] Data, System.Type ModelType) <0x6621340 + 0x00288> in <ee00940cee7542adb6b389ec86003d4f>:0
WASM: at Syncfusion.EJ2.Blazor.Grids.GridColumn.BuildRenderTree (Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) <0x4f18690 + 0x005e4> in <ee00940cee7542adb6b389ec86003d4f>:0
WASM: at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__6_0 (Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder builder) <0x37fc908 + 0x0001a> in <5f68772aa89b467fb3621e07562c53ea>:0
WASM: at (wrapper delegate-invoke) <Module>.invoke_void_RenderTreeBuilder(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder)
WASM: at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch (Microsoft.AspNetCore.Components.Rendering.RenderBatchBuilder batchBuilder, Microsoft.AspNetCore.Components.RenderFragment renderFragment) <0x37fc208 + 0x00058> in <5f68772aa89b467fb3621e07562c53ea>:0
WASM: at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch (Microsoft.AspNetCore.Components.Rendering.RenderQueueEntry renderQueueEntry) <0x37fbc88 + 0x0004c> in <5f68772aa89b467fb3621e07562c53ea>:0
WASM: at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue () <0x37f92f8 + 0x00092> in <5f68772aa89b467fb3621e07562c53ea>:0
VNVignesh Natarajan Syncfusion Team January 28, 2020 10:36 AM UTC
Hi Customer,
Greetings from Syncfusion support.
Query: “t works fine if there is no image already uploaded but crashes on editing when an image has been ”
To replicate the reported issue at our end, we have prepared a sample using your code example in our latest version Nuget package (17.4.0.44). We are able to render the image along with button inside our EditTemplate. Kindly refer the below screenshot and sample for your reference
Also you can save the uploaded file in Grid data using OnActionBegin event of Grid once the file is uploaded. (i.e.) We can store the uploaded file name in variable in FileUploaded event and in OnActionBegin event you can save that to grid datasource. Refer the below codeexample.
We have analyzed your issue’s stack trace and it might occur while serializing the model objects while editing a record. So kindly share the following details which will be helpful for us to validate the reported issue at our end.
Share your Model class to check Image property type and GetImageSrc method.
Share your datasource type.
Ensure that you have referred latest version Nuget package and its corresponding script files.
If possible try to reproduce the reported issue in provided sample.
Regards,
Vignesh Natarajan.
REResponsive EdgeJanuary 29, 2020 04:07 AM UTC
I found the issue. The image was being stored on the model as a byte[] causing that exception. When I converted it to use a base64 string it works. Thanks.
VNVignesh Natarajan Syncfusion Team January 29, 2020 06:56 AM UTC
Hi Customer,
Thanks for the update.
We are glad to hear that you are able to resolve your query.
Kindly get back to us if you have further queries.