Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Why blazor select/inputselect is not working in a new app?

$
0
0

I just created a new .net blazor web app project and added this code

@page "/weather"@attribute [StreamRendering] @rendermode InteractiveServer <PageTitle>Weather</PageTitle><h1>Weather</h1>@using System.Diagnostics<h3>Dropdown Example</h3><select @bind="SelectedSet" class="form-select"><option disabled selected value="">-- Select a Set --</option>    @foreach (var set in Sets)    {<option value="@set">@set</option>    } </select> <p>You selected: @SelectedSet</p><div class="mb-3"><label for="SetType" class="form-label">Set Type</label><InputSelect id="SetType" @bind-Value="CollectionSet" class="form-select">        @foreach (var set in Sets)        {<option value="@set">@set</option>        }</InputSelect> </div> <p>You selected: @CollectionSet</p>@code {    private List<string> Sets = new List<string> { "Pad", "Leather", "Bronze" };    private string SelectedSet { get; set; }    private string CollectionSet { get; set; }    private void OnSetChanged(ChangeEventArgs e)    {        Debug.WriteLine($"Selected value changed to: {SelectedSet}");        // Additional logic can be added here    } }

but when i put a breakpoint on the methods it is just not workingI can't figured out why the event is not triggering. At first I used an enum and i tought it was because of that, but for a simple string it is still not working


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>