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

Send Selected Items to Controller Using Pop-Up Editing

2 Answers 345 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Phillip
Top achievements
Rank 1
Phillip asked on 07 Feb 2019, 03:08 AM

I'm working on a solution where I'm using pop-up editing. On create the the pop-up template appears and the Multi-select dropdown loads with data as shown below.

@(Html.Kendo().MultiSelect().Name("permissionsDropDown")
                  .Placeholder("Select Permissions...")
                  .AutoClose(false)
                  .DataTextField("Name")
                  .DataValueField("Id")
                  .DataSource(source =>
                  {
                      source.Read(read =>
                      {
                          read.Action("GetApplicationPermissions", "PermissionTemplates").Data("addApplicationIdToRequest");
                      })
                          .ServerFiltering(false);
                  })
            )

 

This loads the correct values into the multi select dropdown object correctly. If I select some items they are selected correctly but when I click on the 'Create' button the values are not passed to the controller correctly. The correct number of items is passed to the controller but the value for each is 0 as shown in the attached image.

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 08 Feb 2019, 01:31 PM
Hi Phillip,

First, could you try using the editor, that is remove the .Name() and provide the model field

@(Html.Kendo().MultiSelectFor(model => model.permissionsDropDown)

instead of 

@(Html.Kendo().MultiSelect().Name("permissionsDropDown")

Then, can you confirm there is a class for the multiselect field and that this class is used in the grid model?

I am attaching below a small sample that I made for you which seems to work fine for me, so you can run and compare against it. I deliberately chose a different name for the field for the multiselect so you can see where it goes more clearly.

You can find a more detailed example in the following repo: https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/multiselect-in-grid.


Regards,
Marin Bratanov
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.
0
Phillip
Top achievements
Rank 1
answered on 13 Feb 2019, 07:55 PM
Thanks, Marin. I was able to get the selected items passed back to the controller using the method you suggested.
Tags
MultiSelect
Asked by
Phillip
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Phillip
Top achievements
Rank 1
Share this question
or