MultiSelect submits only one value

2 posts, 1 answers
  1. kabbas
    kabbas avatar
    11 posts
    Member since:
    May 2011

    Posted 28 Mar 2013 Link to this post

    Hello,

    I'm experiencing a problem where the multislect submits the value of one item only even if more than one item is selected. Shouldn't it submit all the values delimited by a comma?

    Here is my code:

    View:
    @using (Html.BeginForm("Send", "MultiSelect", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
    <div class="demo-section">
        <h3 class="title">Select Continents</h3>
        @(Html.Kendo().MultiSelect()
                .Name("multiselect")
                .DataTextField("Text")
                .DataValueField("Value")
                .BindTo(continents)
                .Events(e =>
                {
                    e.Change("change").Select("select").Open("open").Close("close").DataBound("dataBound");
                })
        )
    </div>
        <input id="sendButton" type="submit" value="   Send   " />
    }
    Contoller:

    public partial class MultiSelectController : Controller
        {
            public ActionResult Events()
            {
                return View();
            }
     
            public ActionResult Send(string multiselect)
            {
                //the string parameter multiselect has only one value even if more than one                      //value is selected
                return View();
            }
        }
    Is there something wrong I am doing??
  2. Answer
    kabbas
    kabbas avatar
    11 posts
    Member since:
    May 2011

    Posted 28 Mar 2013 Link to this post

    I figured out my problem, I should use an IEnumerable<string> to receive the values instead of just a string.

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