I have a controller with code like this
public ActionResult Edit(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Assembly assembly = db.Assemblies.Find(id);
var assemblyViewModel = new AssemblyViewModel
{
AssemblyId = assembly.AssemblyId,
Description = assembly.Description,
AssemblyItemMasterIds = db.AssemblyItems
.Where(w => w.AssemblyId == assembly.AssemblyId)
.Select(s => s.ItemMasterId)
.ToList()
};
return PartialView(assemblyViewModel);
}
The view looks like this.
@(Html.Kendo().MultiSelectFor(model => model.AssemblyItemMasterIds)
.Name("AssemblyItemMasterIds")
.DataTextField("text")
.DataValueField("id")
.Placeholder("Select Items...")
//.AutoBind(false)
.DataSource(source => {
source.Read(read =>
{
read.Action("GetItemMasters", "ItemMasters");
})
.ServerFiltering(true);
})
)
I have validated that the model is populated and that AssemblyItemMasterIds does have a list of the id's that should be selected.
If I click on the dropdown, the selected values populate. Shouldn't they be populating without me having to that?
What am I missing?