I'm learning to use MudBlazor, and I'm starting with a simple MudSelect element like so:
<MudSelect Label="Select..." @bind-Value="_selectedFruitCode">
@foreach(var fruitCode in fruitCodes)
{
Console.WriteLine(fruitCode.Descr);
<MudSelectItem [email protected]>@projectCode.Descr</MudSelectItem>
}
</MudSelect>
I see the fruits logged on the console, and I see that the selection defaults to the value I assign to _selectedFruitCode in the constructor, but when I click to make a selection, no selections appear.
What am I doing wrong?
I'm learning to use MudBlazor, and I'm starting with a simple MudSelect element like so:
<MudSelect Label="Select..." @bind-Value="_selectedFruitCode">
@foreach(var fruitCode in fruitCodes)
{
Console.WriteLine(fruitCode.Descr);
<MudSelectItem [email protected]>@projectCode.Descr</MudSelectItem>
}
</MudSelect>
I see the fruits logged on the console, and I see that the selection defaults to the value I assign to _selectedFruitCode in the constructor, but when I click to make a selection, no selections appear.
What am I doing wrong?
Share Improve this question edited Apr 2 at 1:51 Zhi Lv 22k1 gold badge27 silver badges37 bronze badges asked Mar 12 at 16:21 Vivian RiverVivian River 32.5k64 gold badges210 silver badges324 bronze badges 1- 2 You're almost certainly statically rendering the page. See stackoverflow/a/79477619/13065781 and stackoverflow/a/77615133/13065781. Also MS Document - learn.microsoft/en-us/aspnet/core/blazor/components/… – MrC aka Shaun Curtis Commented Mar 12 at 17:58
1 Answer
Reset to default 1It turns out that somehow, the server side rendering wasn't turned on, so no interactive components could work.
I had to add to the page
@rendermode InteractiveServer
To get that to build, I also had to add to _Imports.razor
@using static Microsoft.AspNetCore.Components.Web.RenderMode
And to MainLayour.razor, I had to add
<script src="_framework/blazor.server.js"></script>