MultiSelect in Grid - Too many object

2 posts, 0 answers
  1. Ben Baker
    Ben Baker avatar
    3 posts
    Member since:
    Aug 2006

    Posted 04 Jan 2015 Link to this post

    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")

    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[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[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.

  2. Georgi Krustev
    Georgi Krustev avatar
    3707 posts

    Posted 06 Jan 2015 Link to this post

    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.

    Georgi Krustev

    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.

  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top