Article: ASP.Net Core Razor Pages: Keep DropDownList value selected after Form Submit (Post)
I downloaded the solution adn it works great. I create new page within your solutioon and it works great.
when I copy the files to bring into my project I get the code to compile without any issue going against same table in your example.
The connection string int he startup is connecting.
All the code compiles but when it tries to populate the table I get an innerexception that
"Sequence contains more than one matching element"
its happening on the onget
public void OnGet()
{
this.PopulateDropDownList();
}
public void PopulateDropDownList()
{
this.Customers = new SelectList(this.Context.Customers, "CustomerId", "Name");
}