Posts

Showing posts from December 6, 2018

When creating double dropdown SelectList with JQuery on POST returns 0. ASP.Net CORE 2.1

Image
up vote 0 down vote favorite I have created two dropdownlists, of which one acts as a filter for the other. So, with dropdown Customer a customer is selected and only a limited set of ClientUsers is presented in in the dropdown ClientUser . I use a Jquery function to make this happen. The selection works excellent, but when I POST the form the ClientUser is set to 0, instead of the choice. The View is as follows (simplified for readability purposes): @model DropDownTester2.Models.CaseViewModel <form asp-action="Maak"> <label asp-for="CaseTitle" class="control-label"></label> <input asp-for="CaseTitle" class="form-control" /> <select id="customerId" asp-for="CustomerId" asp-items='@(new SelectList(ViewBa