This example demonstrates how to use data editors in bound and unbound modes to edit Model fields.
Use the editor's PreRender property to specify multiple selected items based on the enumerable Model field.
settings.PreRender = (sender, e) => {
ASPxCheckBoxList cbl = (ASPxCheckBoxList)sender;
foreach(ListEditItem item in cbl.Items) {
item.Selected = Model.ProgLanguages.Contains((int)item.Value);
}
};
Call the editor's GetSelectedValues method to get multiple selected items on the Controller side. To obtain Model fields from the corresponding editor, use a DevExpressEditorsBinder object.
public ActionResult Index([ModelBinder(typeof(DevExpressEditorsBinder))] MyModel model) {
model.ProgLanguages = CheckBoxListExtension.GetSelectedValues<int>("ProgLanguagesUnbound");
TempData["PostedModel"] = model;
return RedirectToAction("Success");
}
(you will be redirected to DevExpress.com to submit your response)