Let's define the dictionary I'm using as searchBoardGames[image.Id]
The select is in a foreach loop so I can render multiple select elements because what I'm trying to do is collect data from the user for multiple entries, but using the same list of gameIds. The @foreach loop with the <select> would be something like this:
<div class="image-gallery"> @foreach (var image in images) {<div class="image-item"><img src="data:image/png;base64,@Convert.ToBase64String(image.ImageData)" alt="Unknown Image" /><div id="boardGameSelect" class="board-game-select"> @if (searchResults.ContainsKey(image.Id) && searchResults[image.Id].Any()) {<select id="@selectInputId" @bind="searchBoardGames[image.Id]"><option value="">-- Select a Board Game --</option> @foreach (var game in searchResults[image.Id]) {<option value="@game.Id">@game.Name</option> }</select> }</div></div> }</div>So now the problem is the @bind=searchBoardGames[image.Id] isn't going to work, but I can't figure out how to get around this problem. I can't add an @onchange because that's used by @bind and I haven't been able to construct a method that could return something because it needs to be bound to a Property, not the value of some returned variable.