Darkmatter5
Darkmatter5

Reputation: 1249

Disable a button if row is selected in MudBlazor Table

I'm trying to disable a button if no row is selected in a MudTable, so I'm trying to do something like the following.

Disabled=(selectedRow is null)

How would I do this properly?

Upvotes: 0

Views: 1836

Answers (1)

Lex
Lex

Reputation: 7194

Use the .SelectedItem property of the MudTable.

<MudTable @ref="mudTable">
    <!-- other table stuff inside here -->
</MudTable>

<button disabled="@(mudTable.SelectedItem == null)" 
        @onclick="DoSomething">Click Here</button>

Upvotes: 0

Related Questions