I am looking for a way to pass currently selected model from view to controller. My select code:
<select asp-for="Product">
@foreach (var p in Model.Products)
{
<option value="@p">@p.ProductName</option>
}
</select>
I'm trying to bind option value @p to bind with my property below:
[BindProperty]
public Product Product { get; set;}
But whenever after submitting my form the Product property has "null" values. Any suggestions?