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

How do I send selected values to Action Method?

1 Answer 84 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Joel asked on 19 Apr 2019, 07:29 PM

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)
        {
            
        }





1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 22 Apr 2019, 03:31 PM
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.
Tags
MultiSelect
Asked by
Joel
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or