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
close icon

AllowRowDragAndDrop="true" and click other row for finish editing, It throw "System.InvalidOperationException: Nullable object must have a value


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)




Attachment: SfGridTest_b5de062c.zip

1 Reply

PS Prathap Senthil Syncfusion Team November 21, 2022 07:55 AM

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


Attachment: SfGridTest_b348079e.zip

Loader.
Live Chat Icon For mobile
Up arrow icon