How do I send selected values to Action Method?

2 posts, 0 answers
  1. Joel
    Joel avatar
    1 posts
    Member since:
    Feb 2014

    Posted 19 Apr Link to this post

    Hello

    I keep getting null values   I am trying to get a list of  int  or string for  selected  DataValueField.

    Thank you,    


     @using (Html.BeginForm("SetPermitValues", "BusinessLocation"))
                {
                    <div class="modal-body">
                        <label asp-for="SelectedPermitTypes" class="control-label"></label>
                        @(Html.Kendo().MultiSelectFor(b => b.SelectedPermitTypes)
                                                        //.Name("businessPurposes")
                                                        .HtmlAttributes(new { style = "width:100%" })
                                                        .Placeholder("Choose...")
                                                        .DataValueField("Value")
                                                        .DataTextField("Text")
                                                        .DataSource(source =>
                                                        {
                                                            source.Read(read =>
                                                            {
                                                                read.Action("GetPermitTypesAsync", "BusinessLocation", new { id = Model.Id });
                                                            });
                                                        })
                        )
                        <span asp-validation-for="SelectedPermitTypes" class="text-danger"></span>
                   
                    </div>
                    <div class="modal-footer">
                        <button type="button" id="HidebtnModal" class="btn btn-primary">Cancel</button>
                        <button type="submit" class="btn btn-primary">Add New Permit</button>

                    </div>
                }


       [HttpPost]
            public ActionResult SetPermitValues(List<int> Value)
            {
                
            }





  2. Eyup
    Admin
    Eyup avatar
    3827 posts

    Posted 22 Apr Link to this post

    Hello Joel,

    You can find information about this requirement provided in the following post:
    https://www.telerik.com/forums/how-do-i-post-selected-values-to-controller#UXIlcd-BfE21hBP0VkQkfg

    If you prefer, I can also prepare a new MVC sample and send it over to you.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top