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

MultiSelect in Grid - Too many object

1 Answer 76 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Ben Baker
Top achievements
Rank 1
Ben Baker asked on 04 Jan 2015, 03:49 PM
I'm currently struggling with the MultiSelect inside a Grid Editor Template in that the posted model has too many strings.

This is from my editor template...

@(Html.Kendo().MultiSelectFor(model => model.messages)
      .Name("key_messages") // With or without makes no difference
      .Placeholder("Select Key Messages")
      .BindTo((System.String[])ViewData["key_messages"]))

My string array, "key_messages" is defined in my controller

string[] key_messages = { "work ethic", "efficiency", "fiscal" };
ViewData["messages"] = key_messages;

In my model

public string[] key_messages { get; set; } //I've also tried using List<string> with same results

Using fiddler, I can see that the posted data contains way too many objects.  For example, if I select "work ethic" and "efficiency", I get the following.

key_messages[0]
key_messages[1] work ethic
key_messages[2] work ethic
key_messages[3] efficiency

To make matters worse, if I save this, then attempt to remove one of the "work ethics", I get this (even though only two selections remain)...

key_messages[0]
key_messages[1] work ethic
key_messages[2] work ethic
key_messages[3] efficiency
key_messages[4] work ethic
key_messages[5] efficiency

I'm assuming that this is some type of serialization problems but I've not been able to put my finger on the problem.  

Please help.

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 06 Jan 2015, 05:02 PM
Hi Ben,

This is a strange problem. There is a slight chance that this could be related to this bug report. Could you review it and let me know if this is the case? If it isn't, would it be possible to send us more details about your current implementation that will help to replicate the problem locally? A runnable test project will be of a great help.

Regards,
Georgi Krustev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
MultiSelect
Asked by
Ben Baker
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or