Post selected values to controller

2 posts, 0 answers
  1. Austin
    Austin avatar
    24 posts
    Member since:
    Jun 2015

    Posted 08 Jun 2016 Link to this post

    I seem to be having a problem posting the selected values from my Kendo Multiselect widget to an action on my controller. I've never had this issue before and as far as I know I am doing everything right, but something is obviously causing an issue.

    I have this input on my view:

    <input id="ProductHandlingTypes" name="ProductHandlingTypes" style="width: 100%"/>


    Here is my viewmodel:

    public class BuyerProfileViewModel
        public string UserId { get; set; }
        public string Name { get; set; }
        public int BuyerTypeId { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Zipcode { get; set; }
        public string Description { get; set; }
        public List<int> ProductHandlingTypes { get; set; }
        public bool Producer { get; set; }



        placeholder: "-- Select Type(s) --",
        dataTextField: "Name",
        dataValueField: "Id",
        dataSource: new{
            transport: {
                read: {
                    url: "/Helper/GetProductHandlingTypes",
                    dataType: "json",
                    type: "GET"
    $("#btnSave").on("click", function (e) {
        var formCreate = $(".form-register-buyer");
        if (formCreate.valid()) {
            var options = {
                url: $(formCreate).attr("action"),
                type: $(formCreate).attr("method"),
                data: $(formCreate).serialize()
                .done(function(data) {
                    if (data.success === true) {
                        window.location.href = data.redirectTo;
                    } else {
                        toastr.options = { "postiionClass": "toast-bottom-full-width" };
                        toastr.error(data.message, "Uh, Oh!");


    And a snippit of my controller:

    public ActionResult BuyerProfile(BuyerProfileViewModel model)
        if (ModelState.IsValid)
            // do stuff here


    All of the rest of the values post to the controller just fine. But when I hover over the model this is what I see for "ProductHandlingTypes" (I've attached a screenshot)



  2. Austin
    Austin avatar
    24 posts
    Member since:
    Jun 2015

    Posted 09 Jun 2016 in reply to Austin Link to this post

    Figured it out. I needed to change it from an <input> to a <select multiple>. Now all of the values are being posted to the controller.
Back to Top