Send Selected Items to Controller Using Pop-Up Editing

3 posts, 1 answers
  1. Phillip
    Phillip avatar
    9 posts
    Member since:
    May 2018

    Posted 06 Feb Link to this post

    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. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    4893 posts

    Posted 08 Feb Link to this post

    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.
  3. Phillip
    Phillip avatar
    9 posts
    Member since:
    May 2018

    Posted 13 Feb Link to this post

    Thanks, Marin. I was able to get the selected items passed back to the controller using the method you suggested.
Back to Top