Airsicktitan
Airsicktitan
CC#
Created by Airsicktitan on 11/22/2023 in #help
✅ @onchange event not triggering
@page "/" <PageTitle>Home</PageTitle> @if(People != null) { <h3>People:</h3> <select @onchange = "ItemSelected" size="4" style="width: 10%;"> @foreach(var person in People) { <option value="@person.Id.ToString()"> @person.Name </option> } </select> @if (SelectedPerson != null) { <br /> <div> Selected Person: @SelectedPerson.Name </div> } else { <div> No name is selected. </div> } } @code{ Person SelectedPerson; void ItemSelected(ChangeEventArgs args) { SelectedPerson = (from p in People where p.Id == Convert.ToInt32(args.Value.ToString()) select p).FirstOrDefault(); } private List<Person> People; public class Person { public int Id { get; set; } = 0; public string Name { get; set; } = "Undefined"; } protected override void OnInitialized(){ People = new List<Person>(); People.Add(new Person { Id = 1, Name = "Kara Danvers" }); People.Add(new Person { Id = 2, Name = "J'onn J'onzz" }); People.Add(new Person { Id = 3, Name = "Clark Kent" }); People.Add(new Person { Id = 4, Name = "Barry Allen" }); } }
13 replies
CC#
Created by Airsicktitan on 11/14/2023 in #help
✅ The current .NET SDK does not support targeting .NET 8.0. Either Target .NET 6.0 or lower
I am pretty new to C# and web app development with it. I do SQL database management as my day job. I saw that .NET 8 Blazor Web App was released today and I wanted to try it out! But unfortunately, when I spin up the template.... I get the error listed in the title. I've updated my Visual Studio 2022 IDE, and I've installed .NET 8 SDK. What can I do to resolve this issue? Thank you in advanced!
36 replies