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

Multiselect values when creating/updating a record

1 Answer 58 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
MiracleMan
Top achievements
Rank 1
MiracleMan asked on 19 Sep 2015, 11:36 PM

Hello, I just started working with the product.  I created a grid using the MVC control.  Also, the grid is using a custom pop up form when editing/creating a record.

 Inside that custom form, I added a multiselect control. The control should reference values stored in a child table from the record, basically I want to store multiples agencies a person can belong to.  The model have a reference to the child table. 

When submitting the form, the entity object knows that I ​selected X amount of companies, but I cant get to the values. What is the best way of doing this for a child table?

 

<label for="Agency" class="required col-sm-3 control-label" style="text-align:left;margin-right:-55px">Insurance Companies</label>
            @(Html.Kendo().MultiSelect()
                  .Name("tblAgentInsurers")
                  .DataTextField("InsuranceAgencyName")
                  .DataValueField("InsuranceAgencyID")
                  .Placeholder("Select agencies...")
                  .HtmlAttributes(new { @class = "col-sm-2 form-control", style = "width:70%; height:auto; min-height: 34px;" })
                  .AutoBind(false)
                  .Filter(FilterType.Contains)
                  .DataSource(source =>
                  {
                      source.Read(read =>
                      {
                          read.Action("GetAgencies", "Agents");
                      })
                      .ServerFiltering(true);
                  })
            )​

 

1 Answer, 1 is accepted

Sort by
0
MiracleMan
Top achievements
Rank 1
answered on 21 Sep 2015, 02:07 PM
I was able to solve this by creating a new view model.
Tags
MultiSelect
Asked by
MiracleMan
Top achievements
Rank 1
Answers by
MiracleMan
Top achievements
Rank 1
Share this question
or