Lasse Edsvik
Lasse Edsvik

Reputation: 9298

Serialize Kendo UI MVC MultiSelect as array

I have this Kendo UI multiselect:

@(Html.Kendo().MultiSelect()
      .Name("EditModel.Modules.ID")
      .DataValueField("ID")
      .DataTextField("Name")
      .Filter(FilterType.Contains)
      .DataSource(source =>
      {
        source.Read(read =>
                    {
                    read.Action("GetModules", "Modules");
                    })
                   .ServerFiltering(true);
                    }))

How can I add [index] to name so the array maps to the array in my editmodel?

Upvotes: 2

Views: 1977

Answers (1)

Atanas Korchev
Atanas Korchev

Reputation: 30671

You could try using

@(Html.Kendo().MultiSelectFor(model => model.Property))

It is important that you must not the Name() in this case (it will be set automatically to the correct value).

Upvotes: 2

Related Questions