Blazorise DataGrid syntax to create and execute Commands with parameters on a Button?

2.5k views Asked by At

How does one save data (multiple rows) in a Blazorise DataGrid?

Is there an example of the code including the C# functions to update a database?

1

There are 1 answers

0
Jon Wright On

Blazorise uses automatic CRUD - but you need to call something like this in code:

async Task OnSaveClicked()
{

    // check validation if needed

    if (Items != null)
    {
        await _context.SaveChangesAsync();
    }

to update the database. It only needs to be done once for the whole grid.

I suggest using EditMode="DataGridEditMode.Inline for inline editing.

If an error occurs it will show a Reload at the bottom - check your browser developer tools to see what has caused the error.