I am newcomer to blazor and writing a blazor web app. I would like to run some logic after the user has made a selection in the select control. I have tried both onchange and onselect events . The event is not firing. I will appreciate if someone could help me here.
@page "/"
<select id="ABC" @onchange="GroupSelected">
<option>A</option>
<option>B</option>
<option>C</option>
</select>
<hr />
<label>@SelectedGroup</label>
@code
{
string SelectedGroup = "Z";
public void GroupSelected()
{
SelectedGroup += "A";
StateHasChanged();
return ;
}
}
after the @page directive, add.. @rendermode InteractiveServer
it tells the compiler to interactively communicate with the server (where the C# code resides)
Hope it helps..