using SfGrid with AllowRowDragAndDrop="true" and click another Row for finish editing, It throw "System.InvalidOperationException: Nullable object must have a value." An error occurs.
When I hit enter to finish editing, no error occurs.
It happens in version 20.3.0.57 .
Source is attached. I have put the video together in a zip.
Uncaught Error Error: System.InvalidOperationException: Nullable object must have a value.
at endInvokeDotNetFromJS (localhost꞉5120/_framework/blazor.server.js:1:3700)
at <anonymous> (localhost꞉5120/_framework/blazor.server.js:1:72077)
at _invokeClientMethod (localhost꞉5120/_framework/blazor.server.js:1:72063)
at _processIncomingData (localhost꞉5120/_framework/blazor.server.js:1:70105)
at connection.onreceive (localhost꞉5120/_framework/blazor.server.js:1:64508)
at o.onmessage (localhost꞉5120/_framework/blazor.server.js:1:48842)
Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Nullable object must have a value.
System.InvalidOperationException: Nullable object must have a value.
at Syncfusion.Blazor.Grids.Internal.Edit`1.EndEdit()
at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.CellClickHandler(MouseEventArgs e, Boolean IsCheckBox)
at Syncfusion.Blazor.Grids.Internal.GridCell`1.<BuildRenderTree>b__0_5(MouseEventArgs e)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost: Error: Unhandled exception in circuit 'JSHZ1JIDAgm57hNOIHiPQM7kN253x8lKbFtnbrCxp9Y'.
System.InvalidOperationException: Nullable object must have a value.
at Syncfusion.Blazor.Grids.Internal.Edit`1.EndEdit()
at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.CellClickHandler(MouseEventArgs e, Boolean IsCheckBox)
at Syncfusion.Blazor.Grids.Internal.GridCell`1.<BuildRenderTree>b__0_5(MouseEventArgs e)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
[2022-11-20T13:15:52.889Z] Error: System.InvalidOperationException: Nullable object must have a value.
at Syncfusion.Blazor.Grids.Internal.Edit`1.EndEdit()
at Syncfusion.Blazor.Grids.Internal.GridCellBase`1.CellClickHandler(MouseEventArgs e, Boolean IsCheckBox)
at Syncfusion.Blazor.Grids.Internal.GridCell`1.<BuildRenderTree>b__0_5(MouseEventArgs e)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
[2022-11-20T13:15:52.889Z] Information: Connection disconnected.
Uncaught Error Error: Cannot send data if the connection is not in the 'Connected' State.
at send (localhost꞉5120/_framework/blazor.server.js:1:52080)
at _sendMessage (localhost꞉5120/_framework/blazor.server.js:1:68715)
at _sendWithProtocol (localhost꞉5120/_framework/blazor.server.js:1:68756)
at send (localhost꞉5120/_framework/blazor.server.js:1:68864)
at beginInvokeDotNetFromJS (localhost꞉5120/_framework/blazor.server.js:1:131820)
at w (localhost꞉5120/_framework/blazor.server.js:1:2164)
at invokeMethodAsync (localhost꞉5120/_framework/blazor.server.js:1:4014)
at <anonymous> (localhost꞉5120/_framework/blazor.server.js:1:11530)
at T (localhost꞉5120/_framework/blazor.server.js:1:11708)
at I (localhost꞉5120/_framework/blazor.server.js:1:11499)
at dispatchGlobalEventToAllElements (localhost꞉5120/_framework/blazor.server.js:1:13988)
at onGlobalEvent (localhost꞉5120/_framework/blazor.server.js:1:13247)
Uncaught Error Error: Cannot send data if the connection is not in the 'Connected' State.
at send (localhost꞉5120/_framework/blazor.server.js:1:52080)
at _sendMessage (localhost꞉5120/_framework/blazor.server.js:1:68715)
at _sendWithProtocol (localhost꞉5120/_framework/blazor.server.js:1:68756)
at send (localhost꞉5120/_framework/blazor.server.js:1:68864)
at beginInvokeDotNetFromJS (localhost꞉5120/_framework/blazor.server.js:1:131820)
at w (localhost꞉5120/_framework/blazor.server.js:1:2164)
at invokeMethodAsync (localhost꞉5120/_framework/blazor.server.js:1:4014)
at <anonymous> (localhost꞉5120/_framework/blazor.server.js:1:11530)
at T (localhost꞉5120/_framework/blazor.server.js:1:11708)
at I (localhost꞉5120/_framework/blazor.server.js:1:11499)
at dispatchGlobalEventToAllElements (localhost꞉5120/_framework/blazor.server.js:1:13988)
at onGlobalEvent (localhost꞉5120/_framework/blazor.server.js:1:13247)
Hi
Greetings from Syncfusion support
The custom adaptor support, allows you to perform manual operations on the data. We noticed that you did not perform the Insert, Remove, and Update operations in your code, which is why you had that issue. Kindly refer to the code snippet and modified sample solution below for your convenience.
public override async Task<Object?> InsertAsync(DataManager dm, object value, string key) { data.Insert(0, value as TestDto); return value; } public override async Task<object> RemoveAsync(DataManager dataManager, object value, string keyField, string key) { data.Remove(data.Where(or => or.Id == int.Parse(value.ToString())).FirstOrDefault()); return value; } public override async Task<object> UpdateAsync(DataManager dataManager, object value, string keyField, string key) { var data1 = data.Where(or => or.Id == (value as TestDto).Id).FirstOrDefault(); if (data1 != null) { data1.Id = (value as TestDto).Id; data1.MenuSetId = (value as TestDto).MenuSetId; data1.DisplayOrder = (value as TestDto).DisplayOrder; data1.Name = (value as TestDto).Name; } return value; } |
Reference Link: https://blazor.syncfusion.com/documentation/datagrid/custom-binding#handling-editing-in-custom-adaptor
Thanks for your help.
But the problem was not solved.
In the code you provided, you set AllowRowDragAndDrop="false".
Try setting this to true. The problem still occurs.
And, if you press the update button of the Toolbar in the editing state, the same error occurs.
If you press Enter while editing, no error occurs.
thanks in advance.
Thanks for Update
We understand that when the update button of the Toolbar is pressed in the
editing state, an error occurs. We have taken note of this and have made
changes in our recent version (20.4.0.44) by setting AllowRowDragAndDrop
as true. However, upon testing, we were unable to reproduce the issue. We
recommend that you upgrade to the latest version of our product to see if it
resolves the issue. To assist you further, we have also included a screen
recording video and sample for your reference. Please let us know if there are
any other concerns, we can assist you with.
It works!
There is no error in the latest version (20.4.0.44).
Thank you very much.
Thanks for the update.
We are glad to hear that it has been resolved. If you have any additional
questions or concerns, please do not hesitate to reach out to us. We are always
here to help.