I'm currently working on an application that displays some movies. I have an API that successfully retrieves the movies and also has the option to get movies by a specific genre. For that I've created a Select element with the different genres dynamically loaded in. When one of the genres is clicked I want to update the movies by using the API to only get the movies in the selected genre.
Unfortunately, nothing happens when I select an option. Please note that I have confirmed that the API calls work so it has to be something in this code.This is the HTML-element:
<div class="content px-sm-3"><select><option onselect="async () => await changeMoviesByGenre('None')" value="None">None</option> @foreach (var genre in genres) {<option value=@genre onselect="async () => await changeMoviesByGenre(genre)">@genre</option> }</select></div>and this is the function that should be called:
private async Task changeMoviesByGenre(string genre) { if (genre == "None") { movies = await MovieClient.Movies.GetAll(); } else { movies = await MovieClient.Movies.GetAllMoviesByGenre(genre); } }