Prevent moving forward without user confirmation during Syncfusion Grid Edit
I'm trying to use a "Save" button to handle grid edits.
I want the user to confirm with "Ok" before proceeding with the save.
Currently the code execution moves forward even without the user clicking either "Ok" or "Cancel".
How to make sure the Save operation proceeds only when the user clicks "Ok"?
This is the runnable sample for your reference:
Hi Ashish Khanal,
We checked your query and based on your description, it seems that you want to
prevent the success message from appearing before the user confirms the action.
The success message should only be shown if the user clicks "OK" in
the confirmation dialog. We would like to inform you that the OnBatchSave event
is triggered only after the user confirms the action by clicking "OK"
in the confirmation dialog. You can use this event to display the success
message. Please refer to the code snippet and the modified sample for
implementation details.
UG : https://blazor.syncfusion.com/documentation/datagrid/events#onbatchsave
Sample : https://blazorplayground.syncfusion.com/VjBejGKXTzPXNsZT
|
<GridEvents RowDataBound="RowDataBoundHandler" QueryCellInfo="QueryCellInfoHandler" CellSelected="CellSelectHandler" OnCellEdit="CellEditHandler" OnBatchSave="BatchSaveHandler" TValue="GridRowViewModelV2"></GridEvents> <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings> <GridColumns> <GridColumn Field="Id" IsPrimaryKey="true" Visible="false" Width="1px" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Left" />
@code { [Parameter] public DateTime AsOfDate { get; set; }
private async Task SaveAllAsync() { // Show the confirmation dialog // The control should not move until the user has clicked "Ok" await Grid.EndEditAsync();
// Get the changes and the unchanged data var gridData = Grid.DataSource; if (gridData is null) return;
}
public void BatchSaveHandler(BeforeBatchSaveArgs<GridRowViewModelV2> args) { // Show success confirmation ShowSuccess("All model data Saved Successfully."); } |
Regards,
Naveen
Thank you, Naveen.
Hi Ashish Khanal,
Welcome.
Kindly get back to us if you have further queries. As always we will be assist
you.
Regards,
Naveen
Hi Ashish Khanal,
Welcome.
Kindly get back to us if you have further queries. As always we will be assist
you.
Regards,
Naveen
- 4 Replies
- 2 Participants
- Marked answer
-
AK Ashish Khanal
- Jul 29, 2025 01:16 PM UTC
- Aug 5, 2025 01:35 PM UTC