This is a migrated thread and some comments may be shown as answers.

MultiSelect not posting objects correctly

1 Answer 390 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
iCognition
Top achievements
Rank 1
iCognition asked on 01 May 2013, 08:18 AM
I have an object:
public class User
{
    public int Id { get; set; }
    public string Name { get; set; }
}
And in the editor template, where model.Members are a collection of Users
@(Html.Kendo().MultiSelectFor(model => model.Members)
    .DataValueField("Id")
    .DataTextField("Name")
    .Placeholder("Type user's name...")
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("MemberRead", "Group");
        });
    }))
When posting the form containing this multiselect I get the following post data
Id:0
Name:Test
Description:Test
Members.Id:1
Members.Name:Jan
Members:[object Object]
Now as far as I can tell the post data is correct, except for"Members:[object Object]" which Kendo throws an error for. When the model is received by the controller, the Members field is null.

What settings are incorrect?

(Note that MemberRead is populating the MultiSelect correctly)

(Also note that this form is part of a popup editor of a grid, in which everything else is working correctly)

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 05 May 2013, 08:41 AM
Hello Matt,

In general, the MultiSelect widget posts selected values of SELECT element. Depending on the given code snippets I suppose that the widget is used as a editor template in the grid. If this is the case I will suggest you examine this code library.
 

Greetings,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
MultiSelect
Asked by
iCognition
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or