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

JsonReaderException when navigate to another page from a grid template

When i navigate to another page from a column template, i have the following exception:
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadAndMoveToContent()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   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(String value, Type type)
   at Syncfusion.EJ2.Blazor.BaseComponent.ChangeType(Object value, Type conversionType)
   at Syncfusion.EJ2.Blazor.BaseComponent.getDirectParam[T](String publicKey)
   at Syncfusion.EJ2.Blazor.BaseComponent.updateProperty[T](String key, T publicValue, T privateValue, Object eventCallback, Expression`1 expression, Boolean isDataSource)
   at Syncfusion.EJ2.Blazor.Grids.EjsGrid`1.OnParametersSetAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadAndMoveToContent()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   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(String value, Type type)
   at Syncfusion.EJ2.Blazor.BaseComponent.ChangeType(Object value, Type conversionType)
   at Syncfusion.EJ2.Blazor.BaseComponent.getDirectParam[T](String publicKey)
   at Syncfusion.EJ2.Blazor.BaseComponent.updateProperty[T](String key, T publicValue, T privateValue, Object eventCallback, Expression`1 expression, Boolean isDataSource)
   at Syncfusion.EJ2.Blazor.Grids.EjsGrid`1.OnParametersSetAsync()
   at Syncfusion.EJ2.Blazor.BaseComponent.UpdateModel(Dictionary`2 properties, Boolean isChildProperty)
Error: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonReader.ReadAndMoveToContent()
   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
   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(String value, Type type)
   at Syncfusion.EJ2.Blazor.BaseComponent.ChangeType(Object value, Type conversionType)
   at Syncfusion.EJ2.Blazor.BaseComponent.getDirectParam[T](String publicKey)
   at Syncfusion.EJ2.Blazor.BaseComponent.updateProperty[T](String key, T publicValue, T privateValue, Object eventCallback, Expression`1 expression, Boolean isDataSource)
   at Syncfusion.EJ2.Blazor.Grids.EjsGrid`1.OnParametersSetAsync()
   at Syncfusion.EJ2.Blazor.BaseComponent.UpdateModel(Dictionary`2 properties, Boolean isChildProperty)
    at Object.endInvokeDotNetFromJS (https://localhost:44315/_framework/blazor.server.js:8:31660)
    at e.<anonymous> (https://localhost:44315/_framework/blazor.server.js:8:103446)
    at https://localhost:44315/_framework/blazor.server.js:1:19202
    at Array.forEach (<anonymous>)
    at e.invokeClientMethod (https://localhost:44315/_framework/blazor.server.js:1:19173)
    at e.processIncomingData (https://localhost:44315/_framework/blazor.server.js:1:17165)
    at e.connection.onreceive (https://localhost:44315/_framework/blazor.server.js:1:10276)
    at WebSocket.i.onmessage (https://localhost:44315/_framework/blazor.server.js:1:38091)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'T0c6F-Xc6pOvqiSJhBCrxPokXz1krbjiRymHa3OBy-w'.

This is the definition of the grid
        <EjsGrid ModelType="@Model" DataSource="@MySources" AllowPaging="true" AllowResizing="true" Toolbar="@(new List<string>() { "Search"})">
            <GridPageSettings PageSize="10"></GridPageSettings>
            <GridSearchSettings Fields="@(new string[] { "Name" })"></GridSearchSettings>
            <GridColumns>
                <GridColumn Field=@nameof(Name) HeaderText="Name" TextAlign="TextAlign.Left" Width="15%"></GridColumn>
                <GridColumn Field=@nameof(Explanation) HeaderText="Explanation" TextAlign="TextAlign.Left"></GridColumn>
                <GridColumn>
                    <Template>
                        <a rel='nofollow' href='@($"/anotherpage/{(context as MyType).Id}")'>
                            <i class="fas fa-pencil-alt pr-xl-2 pr-md-0 pr-2" aria-hidden="true"></i>
                        </a>
                    </Template>
                </GridColumn>
            </GridColumns>
        </EjsGrid>

7 Replies

VN Vignesh Natarajan Syncfusion Team November 28, 2019 05:25 AM

Hi Alain,  

Greetings from Syncfusion support  

Query: “When i navigate to another page from a column template, i have the following exception: 

We have tried to replicate the reported issue by preparing a sample using your code example. But we are unable to reproduce the reported issue at our end. Kindly download the sample from below  


But in your code example, for Field property you have used @nameof(Name), here we face some issue at our end. So we have modified the code to get value from its model class like below. Now we are not able to reproduce any issue.  

<EjsGrid ModelType="@Model" DataSource="@Employees"> 
    <GridColumns> 
        <GridColumn HeaderText="Employee Image" TextAlign="TextAlign.Center" Width="120"> 
            <Template> 
                @{ 
                    <a rel='nofollow' rel='nofollow' href='@($"/counter/{(context as EmployeeData).EmployeeID}")'>Navigate 
                        <i class="fas fa-pencil-alt pr-xl-2 pr-md-0 pr-2" aria-hidden="true"></i> 
                    </a> 
                } 
            </Template> 
        </GridColumn> 
        <GridColumn Field=@nameof(EmployeeData.EmployeeID) HeaderText="Employee ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(EmployeeData.FirstName) HeaderText="First Name" Width="130"></GridColumn> 
        <GridColumn Field=@nameof(EmployeeData.Title) HeaderText="Title" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(EmployeeData.HireDate) HeaderText="Hire Date" Format="yMd" TextAlign="TextAlign.Right" Width="150"></GridColumn> 
    </GridColumns> 
</EjsGrid> 
   
If you are still facing the issue, kindly get back to us with following details.  

  1. Share the details about your Grid dataSource.
  2. Share your Syncfusion Nuget package version
  3. If possible try to reproduce the reported issue in provided sample.
  4. Are you facing the issue during initial rendering itself or after searching a value?

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

Regards, 
Vignesh Natarajan. 



AM Alain Metge November 29, 2019 09:16 AM

Thank you for your answer.

My blazor version is 17.3.0.29-beta.

It seems that the exception is raised from the targeted page not from the leaving page. In my context, the targeted page is the same with just a new id.
I confirm that your sample works for me with my current package, i changed it to navigate to the same page and that works too.

I can't share my code so i will continue to found something which could help you ?
Regards,



VN Vignesh Natarajan Syncfusion Team December 2, 2019 07:20 AM

Hi Alain, 

Thanks for the update.  

Please kindly check this at your end and get back to us with requested details if the reported issue persists.   

Regards, 
Vignesh Natarajan. 



MA MaTaO December 4, 2019 04:55 AM

Hi,

I have the same problem.
I have 2 grids, the first displays normally on the page and the second is on the EjsDialog dialog which will summarize data from the first grid data source.
After the dialog displays include its data  (some does not display i.e. index no. and aggregate result), the exception has been thrown the same as the first comment is written.

nuget version is 17.3.0.29-beta.


RS Renjith Singh Rajendran Syncfusion Team December 5, 2019 09:09 AM

Hi MaTaO,  

Query: “I have the same problem. 
We have prepared a sample based on this scenario and tried to reproduce the problem. But we are not able to reproduce the reported issue. Please downdlaod the sample form the link below, 

We need more details to further proceed on this and provide you a solution as early as possible, kindly share the following details which will be helpful for us to validate the reported issue. 

  1. Share the Grid rendering code example for both the Grid (normal Grid and Grid inside the Dialog).
  2. Share the details how you are navigating from one pager to another.
  3. Share the video demo of the reported issue with replicate procedure.
  4. Are you facing this issue only when use the Aggregate columns in Grid?
  5. If possible share the issue reproducing sample.

Regards, 
Renjith Singh Rajendran. 



TO Tobias August 24, 2020 03:31 AM

Hello,

the following might not be super helpful, but maybe I can give you a hint. I ran into the same problem, but with the Blazor Scheduler. It randomly happened and I was able to pinpoint it further: When my ViewModel for the events DataSource had an enum property, it sometimes failed. As soon as I used an Int32 instead, no problems. The Newtonsoft.Json.JsonReaderException was thrown while the first first letter of the string representation of the enum value was in the process of being deserialized.

Regards,
Tobias


VN Vignesh Natarajan Syncfusion Team August 25, 2020 06:51 AM

Hi Tobias,  
  
Thanks for your suggestion.  
  
We will consider the same if we face the similar issue at our end.   
  
Regards, 
Vignesh Natarajan 
 


Loader.
Live Chat Icon For mobile
Up arrow icon