Question

I am using Kendo MultiSelect as UIHint for one the columns in my Kendo Grid. And I am trying to send selected values of the multiSelect in comma separated string to the server in the databound item.

the entity having the UIHint is like this:

public class Test 
{
    [UIHint("Labels")]
    public string Labels { get; set; }
    //other properies
}

I've a kendo Grid of type Test i.e.

@(Html.Kendo().Grid<Test>().Name("gridMain").Colum...

UIHint Labels.cshtml is like this:

@(Html.Kendo().MultiSelect().Name("Labels") 
    .DataValueField("Id") 
    .DataTextField("Name") 
    .DataSource(s =>
    {
        s.Read(read => read.Action("Labels_Read", "Library"))
    })
)

When I Add/Edit an item, and click on Save, I always receive [Object Object] value in the Labels property on the server side which is like :

public ActionResult Test_Save(Test obj)
{
   //obj.Labels is always having "[Object Object]" value

   // rest of the logic 
}

I've gone through this and few others, even tried to intercept the request on RequestStart and modify the added/edited item .Labels value explicitly, still, my obj( at server) receives [Object Object].

Was it helpful?

Solution

Following setting should sort you out, issue is described here:

 data-value-primitive="true"

Selected value from your multiselect is keyvalue pair of text and id, that is source of the [Object Object]. You can also fix this and any other param related issues in parameterMap

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top