I am currently utilizing Semantic UI for an ASP.NET core project, and I am encountering an issue when trying to submit a form that contains a drop-down element. Despite my efforts, it always returns null, and the lack of proper documentation on this matter adds to the challenge.
<div class="field">
<label>Producer</label>
<select class="ui search dropdown" asp-for="Producer">
<option value="">Select</option>
@foreach (var item in (IEnumerable<Producer>)ViewData["Producers"])
{
<option value="@item.Id">@item.Name</option>
}
</select>
</div>
Regarding the controller (although not particularly relevant in this instance):
[HttpPost]
public IActionResult NewProduct(Product product)
{
return Json(JsonConvert.SerializeObject(product));
}
While the rest of my form operates smoothly, I am encountering challenges specifically with the select
element.