Here is a code snip:
ViewBag.Programs is populated by:
I'm also using:
.. as the property for the saved value in the model.
After I POST, SelectedProgramIds contains the Text Name (but not values) of the entries in the MultiSelect control. How can I get the Value as set by DataValueField(), instead of the DataTextField() after POST?
Also, when the control loads, how can existing items be selected? Currently the box is empty.
@Html.Kendo().MultiSelectFor(model => model.Programs).BindTo((SelectList)ViewBag.Programs).DataTextField("Text").DataValueField("Id").Name("SelectedProgramIds ")
Models.Program[] obj = model.List();
ViewBag.Programs = new SelectList(obj, "Id", "Name", project.Programs);
I'm also using:
public IEnumerable<
String
> SelectedProgramIds { get; set; }
After I POST, SelectedProgramIds contains the Text Name (but not values) of the entries in the MultiSelect control. How can I get the Value as set by DataValueField(), instead of the DataTextField() after POST?
Also, when the control loads, how can existing items be selected? Currently the box is empty.