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

MudSelect items not displaying

$
0
0

My problem is that MudSelect doesn'T show the items...

I have this render mode in my App.razor:

<Routes @rendermode="InteractiveServer" />

and I can click on the up arrow to up the number of an MudInputNumer and it is working, so I think the render mode is working.

I try the MudSelect on a compiler online and it is working fine...

Do you have any idea?

This is the complete page "CommentVerse":

CommentVerse

@page "/CommentVerse"@inject IJerusalemBibleService JerusalemBibleService<EditForm Model="@model" OnValidSubmit="OnValidSubmit"><DataAnnotationsValidator /><MudGrid><MudItem xs="12" sm="7"><MudCard><MudCardContent><MudTextField T="string" Label="Verset(s)" Variant="Variant.Text" Text="@model.Verses" @bind-Value="model.Verses" Lines="10" /><MudTextField T="string" Label="Commentaire" Variant="Variant.Text" Text="@model.Comment" @bind-Value="model.Comment" Lines="10" /></MudCardContent><MudCardActions><MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Primary" Class="ml-auto">Ajouter</MudButton></MudCardActions></MudCard></MudItem><MudItem xs="12" sm="5"><MudPaper Class="pa-4 mud-height-full"><MudText Typo="Typo.subtitle2">Rechercher un verset</MudText>                @if (InProgress)                {<MudProgressCircular Color="Color.Primary" Indeterminate="true" />                }                else                {<MudSelect @bind-Value="Book" T="string" Label="Livres bibliques">                        @foreach (var book in BiblesBooks.FrenchCatholic)                        {<MudSelectItem Value="@book"/>                        }</MudSelect><MudNumericField Label="Chapitre" @bind-Value="Chapter" Min="1" Max="1000" /><MudNumericField Label="Verset" @bind-Value="Verse" Min="1" Max="1000" />                }<MudButton @OnClick="@(() => AddVerse)" /></MudPaper></MudItem></MudGrid></EditForm>@code {    CommentDto model = new CommentDto();    bool Success;    string Book { get; set; }    int Chapter { get; set; } = 1;    int Verse { get; set; } = 1;    string? ErrorMessage { get; set; } = null;    bool InProgress { get; set; } = false;    public int IntValue { get; set; }    private void OnValidSubmit(EditContext context)    {        Success = true;        StateHasChanged();    }    private void AddVerse()    {        InProgress = true;        try        {            model.Verses += JerusalemBibleService.GetVerse(Book, Chapter, Verse);        }        catch (Exception ex)        {            ErrorMessage = ex.Message;        }        InProgress = false;    }}

Here is my static list:List

public static class BiblesBooks{    public static List<string> FrenchCatholic = new List<string>()    {"Genèse","Exode","Lévitique","Nombres","Deutéronome","Josué","Juges","Ruth","1 Samuel","2 Samuel","1 Rois","2 Rois","1 Chroniques","2 Chroniques","Esdras","Néhémie","Tobie","Judith","Esther","1 Maccabées","2 Maccabées","Job","Psaumes","Proverbes","Ecclésiaste","Cantique des Cantiques","Sagesse","Ecclésiastique","Isaïe","Jérémie","Lamentations","Baruch","Ézéchiel","Daniel","Osée","Joël","Amos","Abdias","Jonas","Michée","Nahum","Habacuc","Sophonie","Aggée","Zacharie","Malachie","Matthieu","Marc","Luc","Jean","Actes des Apôtres","Romains","1 Corinthiens","2 Corinthiens","Galates","Éphésiens","Philippiens","Colossiens","1 Thessaloniciens","2 Thessaloniciens","1 Timothée","2 Timothée","Tite","Philémon","Hébreux","Jacques","1 Pierre","2 Pierre","1 Jean","2 Jean","3 Jean","Jude","Apocalypse"    };}

Do you have any idea? I do not have any so let me know :)

I want that the MudSelect display the items when I click on it in my page.

Here is the demo:

Demo

Update:This is working on this page:

@page "/counter"<MudPopoverProvider /><MudDialogProvider /><MudSnackbarProvider /><PageTitle>Counter</PageTitle><MudText Typo="Typo.h3" GutterBottom="true">Counter</MudText><MudText Class="mb-4">Current count: @currentCount</MudText><MudButton Color="Color.Primary" Variant="Variant.Filled" @onclick="IncrementCount">Click me</MudButton><MudSelect @bind-Value="Book" T="string" Label="Livres bibliques">    @foreach (var book in BiblesBooks.FrenchCatholic)    {<MudSelectItem Value="@book" />    }</MudSelect>@code {    private int currentCount = 0;    string Book { get; set; }    private void IncrementCount()    {        currentCount++;    }}

I do not know why in CommentVerse this is not working? Did I miss something?


Viewing all articles
Browse latest Browse all 3977

Trending Articles



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