How to show a message yes/no before delete record?

Hi, i have create a small app for testing, in the grid radzen have create a button to delete the record, but i need to show a message yes/no before the delete operation.

I read the documentation and i read the post how to use the Condition to insert the confirm('delete this ?').

How to do this from blazor ?

Many Thanks

Aurelio

Same question here....

The Blazor DataGrid does not have built-in delete confirmation support yet. One can use the Blazor JSInterop though.

  1. Open the Page.razor.cs file and add the following code to the page class
         [Inject]
         IJSRuntime JSRuntime { get; set; }
    
         async Task<bool> Confirm(string message)
         {
              var result = await JSRuntime.InvokeAsync<bool>("confirm", new [] { message });
    
              return result;
         }
    
  2. Then in Radzen use the Invoke method action:
  3. Invoke the deleteXXX data source method if the Confirm method returned true.

Hi..many tanks for the solution..

By Aurelio

Hello Radzen Team,
are you planning to add a "confirm delete" option on Blazor data grids? And on Button controls?
I use it on every delete action...

Regards
Thomas

We probably will at some point. Not scheduled at the moment though.

I use https://blazor.radzen.com/dialog for that.
Either you can have just a message saying "Are you sure?" or show what will be deleted.
It works very well.

1 Like

Where can i find the click event in datagrid?

Thanks for help
Thomas

I use visual studio so I am not familiar with the Radzen tool, unfortunately. I guess you could klick on the red icon with the X and the click event would be there?

No. I cant click on the red X. it must be an event on the grid?!

@Radzen Team: can you explain?

Regards
Thomas

Is a Button component in the DataGrid Column Template. You can use the template designer to reach that button: