When I try to update the DataSource binding on the Grid I get the following error in the browser:
<EjsGrid DataSource="@ts" Toolbar="@gridToolbar">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>
<GridEvents OnActionComplete="OnComplete" TValue="TimeSheets" />
<GridColumns>
…..
public void GetTimesheet()
{
ts = db.TimeSheets.Where(a => a.CustId == CustomerID).ToList();
}
[2019-09-26T21:21:15.251Z] Error: System.AggregateException: One or more errors occurred. (Self referencing loop detected with type 'ReserevesTest.Data.db.TimeSheets'. Path 'dataSource[0].Officer.TimeSheets'.)
---> Newtonsoft.Json.JsonSerializationException: Self referencing loop detected with type 'ReserevesTest.Data.db.TimeSheets'. Path 'dataSource[0].Officer.TimeSheets'.
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer, Object value, JsonProperty property, JsonContract contract, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Type type, Formatting formatting, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings)
at Syncfusion.EJ2.Blazor.BaseComponent.GetSerializedModel()
at Syncfusion.EJ2.Blazor.BaseComponent.GetUpdateModel(Boolean isInit)
at Syncfusion.EJ2.Blazor.BaseComponent.OnAfterRender(Boolean firstRender)
at Syncfusion.EJ2.Blazor.Grids.EjsGrid`1.OnAfterRender(Boolean firstRender)
at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync()
at Microsoft.AspNetCore.Components.Rendering.ComponentState.NotifyRenderCompletedAsync()
--- End of inner exception stack trace ---