My table in db have fields : Id
,Organisation
,Info
.
I want make dropdowm list like that:
I recommend you to define a ViewModel for your page with a OrganisationId
property. Thus this value will be filled when selecting an entry of the organisations dropdown list.
@model BCO.Models.SelectOrganisationViewModel
@{
ViewBag.Title = "OrganisationInfo";
}
@Html.DropDownListFor(o => o.OrganisationId,
new SelectList(ViewBag.Organisations, "Id", "Name"))
The SelectList itself expects
as parameters.