on change in dropdown in blazor code example
Example: blazorstrap dropdown onchange
<select class="form-control" @onchange="@OnSelect" style="width:150px">
@foreach (var template in templates)
{
<option value=@template>@template</option>
}
</select>
<h5>Selected Country is: @selectedString</h5>
@code {
List<string> templates = new List<string>() { "America", "China", "India", "Russia", "England" };
string selectedString = "America";
void OnSelect (ChangeEventArgs e)
{
selectedString = e.Value.ToString();
Console.WriteLine("The selected country is : " + selectedString);
}
}