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

Blazor update a label after selecting option from dropdown list; remove option for other lists after selected

$
0
0

I have a of Hexes, buildings/improvments and NPC Hirelings. I would like to nest via a loop the Hexes, buildings/improvments and NPC Hirelings so that I can assign a hireling to a building that belongs to a Hex via a drop down. And once the Hireling is selected populate a label with some text and also remove/disable the hireling from all other drop down.

<table class="w-50">        @foreach (var hxs in HexName)        {<tr><td colspan="2"><h3> @hxs.HexName Hex</h3></td></tr>                @foreach (var imps in Improvment) if (@hxs.HexName == imps.ImprovementHex)                {<tr><td colspan="2">@imps.ImprovementName - @imps.ImprovementMaterial</td></tr>                    @for (int i = 0; i <= 3; i++)                    {<tr><td class="p-3"><select class="form-select"><option />                                    @foreach (var hire in Hirelings)                                    {<option value="@hire.HirelingId">@hire.HirelingName</option>                                    }</select></td><td class="p-3"> <p>some text heere</p></td></tr>                    }                }        }</table>@code {    private List<Improvements> Improvment = ImprovementsRepository.GetImprovements();    private List<MapHex> HexName = MapHexRepository.GetMapHex();    private List<Hireling> Hirelings = HirelingRepository.GetHirelings();    private string? TotalValue { get; set; }}

I have tried using ChatGPT and Gemini to help create the code but I cannot get it to work.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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