So, I am trying to create a multi-select dropdown list and I want to set some default selected values in it.
I get the values and store them in an array of strings containing the values in each one.
I tried to set them as 1 string and it didn't work, tried setting them as an array of strings and it didn't work as well.
Here is the code:
<select name="FacultyList" multiple class="sel form-control" asp-for="Faculties"
id="uniFaculties" asp-items="@(new SelectList(facultyList,"Name","Name",@selectedFaculties))">
</select>
facultyList is a list of values I get from and api.
selectedFaculties is an array of strings that contains the selected values.
Note: I'm using the Chosen jQuery library as well if that makes a difference.