Iwould like to set a partial View in a form. The problem is that I would like this partial View to be controlled by a controller.
Here is the code of the form :
<select asp-for="Categorie" id="categorie">
<partial name="BudgetSearch" />
</select>
Here is the code of the controller :
public IActionResult BudgetSearch()
{
var bdd = new ComptesBudgetViewModel();
return PartialView(bdd);
}
Here is the code of the partia View :
@model Comptes.core.data.DataLayer.HomeDataLayer.ComptesBudgetViewModel
<option value="" selected>Choisir</option>
@foreach (var budget in Model.Budget)
{
<option value="@budget.Categorie">@budget.Categorie</option>
}
Can someone help me ?