admin管理员组文章数量:1389783
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>
本文标签: blazorHow to render options for MudSelectStack Overflow
版权声明:本文标题:blazor - How to render options for MudSelect? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744740859a2622597.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论