0
votes

preface : this worked at one point, I changed something and I have no idea what has caused it to stop working. This is on MVC5 with kendo 2014.3.1411.545

So I have a kendo mvc grid and I have my template called out like this

.Editable(configurator =>
      configurator
          .Mode(GridEditMode.PopUp)
          .TemplateName("someEditor")
          .Window(x => x.Width(850))
          .CreateAt(GridInsertRowPosition.Bottom)
          .AdditionalViewData(new {CompanyId = Model})

ok, fine, nothing crazy. The editor template has a kendo multiselect like this

@(Html.Kendo().MultiSelectFor(model => model.OrderIds)
  .DataTextField("Text")
  .DataValueField("Value")
  .DataSource(data =>
  {
      data.Read("AllOrders", "Orders", new { categoryId });
  })

my Model has a list of orderIds that are just strings

public class SomeModel 
{   
    //usual, basic string properties, initialized it as a list
    public IEnumerable<string> OrderIds { get; set; }
}

and I've even tried string[], ICollection and list -- nothing seems to serialize it back to the controller, at least not anymore. The binding doesn't seem to pick it up no matter what I try. Might have something to do with trying too many things for way too long now.

The datasource of AllOrders is generating an anonymous object ( new { Text = Order.Number, Value=Order.Id} ) by selecting an orderId and its display number. I tried a List and a few other structures just for fun for the multiselect but nothing has got me back to working. The data is in the post, just as an array of { text:"",value:"" } ... Any ideas what I could be missing?

1
please add full code of your grid setting.Dion Dirza

1 Answers

0
votes

Try setting ValuePrimitive to true

@(Html.Kendo().MultiSelectFor(model => model.OrderIds)
  .DataTextField("Text")
  .DataValueField("Value")
  .ValuePrimitive(true)
  .DataSource(data =>
  {
      data.Read("AllOrders", "Orders", new { categoryId });
  })