Can't save edited record

Hi there, 

I'm having issues saving data with the "Edit" ToolbarItem. The record popping up and editing individual cells works fine. However whenever I try to save an edited item the "Save" button is completely unresponsive (also not invoking any events). Adding new records with "Add" works just fine. Here are Toolbar and GridEvents and GridEditSettings configurations: 

            <SfGrid @ref="Grid" DataSource="@MacrosList" AllowPaging="true"

            Toolbar="@(new List<object> { "Add", "Edit", "Delete", new ToolbarItem{ Text = "Save", PrefixIcon = "e-save" }, "Cancel" })">

                <GridEvents OnToolbarClick="OnToolbarClick" OnActionComplete="GridActionComplete" TValue="MacrosData"></GridEvents>

                <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog"></GridEditSettings>


Currently only "Save" is manually handled to save data to my DB. My personal "Save" functionality is not interfering with Syncfusion's "Save" i assume since creating a new record and saving that works just fine




3 Replies

PS Prathap Senthil Syncfusion Team December 23, 2024 05:06 PM UTC

Hi Franz,

Based on your reported problem, you have encountered an issue where the event is not triggered while editing the data. We suggest the following approach: during editing, check the request type as Save and the action type as Edit. For adding operations, check the action type as Add. Specifically, you can retrieve and handle actions other than editing and adding data, and then store the value in the database. Kindly refer to the code snippet and sample below for your reference.

<SfGrid DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" Height="315">

    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>

    <GridEvents  RowEditing="RowEditingHandler" RowUpdating="RowUpdatingHandler" RowCreating="RowCreatingHandler"  TValue="Order"></GridEvents>

    </SfGrid>

 

@code {

 

    public void ActionComplete(ActionEventArgs<Order> args)

    {

        if (args.RequestType == Syncfusion.Blazor.Grids.Action.BeginEdit)

        {

            // Triggers once editing operation completes

        }

        else if (args.RequestType == Syncfusion.Blazor.Grids.Action.Add)

        {

            // Triggers once add operation completes

        }

        else if (args.RequestType == Syncfusion.Blazor.Grids.Action.Cancel)

        {

            // Triggers once cancel operation completes

        }

        else if (args.RequestType == Syncfusion.Blazor.Grids.Action.Save  && args.Action =="Edit")

        {

            // Triggers once save operation completes//here you can save the edited date on DB

        }

        else if (args.RequestType == Syncfusion.Blazor.Grids.Action.Save && args.Action == "Add")

        {

            // Triggers once save operation completes//here you can save the Added date on DB

        }

        else if (args.RequestType == Syncfusion.Blazor.Grids.Action.Delete)

        {

            // Triggers once delete operation completes

        }

    }

}


Sample:https://blazorplayground.syncfusion.com/embed/BjVTWLVKJUjhovAp?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

If the issue still persists could you please share the issue simple reproducible sample or replicate the issue in the attached sample? This information will help us replicate the issue and assist you more effectively.

Additionally, we would like to inform you that your approach is valid. However, we would like to inform you that the OnActionBegin and OnActionComplete event for CRUD actions will soon be deprecated. We have introduced separate events for each CRUD operation, and it is recommended that you handle specific actions with the new events instead. In your case, we suggest using the RowUpdating event to achieve your requirement.

References:



New Event Information

Event Name

Argument Name

Properties

Description

RowCreating

RowCreatingEventArgs

Cancel, Data, Index, EditContext

Gets or sets the event callback that is raised before the add action is performed in the grid.

RowCreated

RowCreatedEventArgs

Data, Index, EditContext

Gets or sets the event callback that is raised after the add action is performed in the grid.

RowUpdating

RowUpdatingEventArgs

Cancel, IsShiftKeyPressed, KeyCode, Data, Index, PreviousData, PrimaryKeys, PrimaryKeyValue

Gets or sets the event callback that is raised before the save action is performed in the grid.

RowUpdated

RowUpdatedEventArgs

Data, Index, PreviousData, PrimaryKeys, PrimaryKeyValue

Gets or sets the event callback that is raised after the save action is performed in the grid.

RowDeleting

RowDeletingEventArgs

Cancel, Datas, PrimaryKeys

Gets or sets the event callback that is raised before the delete action is performed in the grid.

RowDeleted

RowDeletedEventArgs

Datas, PrimaryKeys

Gets or sets the event callback that is raised after the delete action is performed in the grid.

EditCanceling

EditCancelingEventArgs

Cancel, Data, PreviousData, PrimaryKeys, Index

Gets or sets the event callback that is invoked before the cancel action is performed in the grid, specifically when using normal and dialog edit modes.

EditCanceled

EditCanceledEventArgs

Data, PreviousData, PrimaryKeys, Index

Gets or sets the event callback that is invoked after the cancel action is performed in the grid, specifically when using normal and dialog edit modes.

OnRowEditStart

OnRowEditStartEventArgs

Cancel, PreventDataClone

Gets or sets the event callback that is raised before an editing action is performed in the grid.

RowEditing

RowEditingEventArgs

Cancel, PrimaryKeys, PrimaryKeyValue, Data, Index, EditContext, ForeignKeyData

Gets or sets the event callback that is raised before the edit action is performed in the grid.

RowEdited

RowEditedEventArgs

PrimaryKeys, PrimaryKeyValue, Data, Index, EditContext, ForeignKeyData

Gets or sets the event callback that is raised after the edit action is performed in the grid.



Regards,
Prathap Senthil



MA Marc October 10, 2025 10:01 AM UTC

I have the same issue. Any suggestion?



PS Prathap Senthil Syncfusion Team October 13, 2025 10:27 AM UTC

Based on the report, it appears you have encountered an issue where data is not being saved on the database side while editing. We suggest using the RowUpdating or RowUpdated event, which allows you to retrieve and handle actions beyond just editing and adding data, and then store the values in the database accordingly.

If the issue still persists, could you please share a simple, reproducible sample or code snippet ? This will help us better understand and reproduce the issue, so we can assist you more effectively.


Loader.
Up arrow icon