Multiselect values when creating/updating a record

2 posts, 0 answers
  1. MiracleMan
    MiracleMan avatar
    11 posts
    Member since:
    Aug 2015

    Posted 19 Sep 2015 Link to this post

    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);
                      })
                )​

     

  2. MiracleMan
    MiracleMan avatar
    11 posts
    Member since:
    Aug 2015

    Posted 21 Sep 2015 Link to this post

    I was able to solve this by creating a new view model.
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top