I have a jquery combo that is multiselection enabled with checkboxes. After I have ticked multiple items and press the submit button my model in the controllers post action only has the combos last selected item and not the multiple selected values. The MVC razor code is as follows:
@(Html.Infragistics().ComboFor(Function(model) model.AreasToString) _ .ID("cboAreas") _ .MultiSelection(ComboMultiSelection.OnWithCheckboxes) _ .DataSource(ViewData("Areas")) _ .ValidatorOptions(Function(m) m.OnBlur(False).OnChange(False).OnSubmit(True)) _ .ItemSeparator("|") _ .Mode(ComboMode.DropDown) _ .Width("200") _ .NullText("Select Areas") _ .Render() )
Lets say my items (areas) in the above example are 'North','South','East','West'. I tick 'North' and 'West' in the combo dropdown and the combo text shows "North|West". When I submit my action only receives 'West'.
Hi redrabbit,
In order to persist multiselection, the combo-field in model of your application should be type of array. Otherwise, the only single selected item can be maintained.Please check type of combo-field-property in your model. If it is "string", then replace it by "string[]", if it is "int", then replace it by "int[]", etc.
Note: if you use ComboFor(...), or Combo(string), then there is no need to set ID property of combo. The ID property is designed when combo is created using blank helper like Combo().
Thank you, with your help I have sorted the problem.