Set selected items from viewmodel

6 posts, 0 answers
  1. Shane P
    Shane P avatar
    86 posts
    Member since:
    Sep 2012

    Posted 16 Apr 2013 Link to this post

    I am trying to use the MultiSelectFor without to much luck. I have

    @Html.Kendo().MultiSelectFor(m => m.SelectedEmployeeIds).BindTo(Model.Employees).DataTextField("EmployeeName").DataValueField("EmployeeId").ItemTemplate("<span class='span2'>#: data.EmployeeName #</span><span><strong>#: data.Email #</strong></span>").Placeholder("Select Names")
    Posting the contents to the controller works correctly however when the view is loaded any "SelectedEmployeeIds" are not displayed.

    Any help would be great.

    Thank you
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 17 Apr 2013 Link to this post

    Hello Shane,

     
    Here is a quote of my answer posted in the support ticket opened on the same subject:

    The problem is related to a limitation in the MultiSelect for ASP.NET MVC, which can be bound only to List<string> instance. This is addressed in the latest internal build of Kendo UI.

    Kind regards,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Jonathan
    Jonathan avatar
    2 posts
    Member since:
    Apr 2013

    Posted 26 Apr 2013 Link to this post

    Hi Georgi,

    I've updated my project using visual studio (menu telerik -> kendo -> upgrade)

    But this is not working ...

    Here is the code in MVC Controller:
    ViewBag.AccomodationBOFees = new SelectList(db.Fees.Where(f => f.FEETOFID == EITWEP.Utils.WEPConstants.FeeConstant.AccomodationTypeOfFeeID).OrderBy(f => f.FEETitle), "FEEID", "FEETitle");
    SelectList selectedBOFees = new SelectList(db.Fees.Where(f=> f.FEEID == 565), "FEEID", "FEETitle");
    Here is the code in the CSTHML file

    @(Html.Kendo().MultiSelect().Value(ViewBag.selectedBOFees)
        .Name("RelatedFees").HtmlAttributes(new { style = "width: 500px;" }).BindTo(ViewBag.AccomodationBOFees).Filter("contains").MinLength(2)
    )
    I've got the following error:

    The best overloaded method match for
    'Kendo.Mvc.UI.Fluent.MultiSelectBuilder.Value(System.Collections.Generic.IEnumerable<string>)'
    has some invalid arguments


    Can you please help?

    Thank you
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 30 Apr 2013 Link to this post

    Hello Jonathan,

     
    The aforementioned issue is fixed in the last internal build, which is available only for paid customers. Note also that the Visual Studio update cannot not update your project to use latest internal build.

    All the best,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Info Expert-IT
    Info Expert-IT avatar
    1 posts
    Member since:
    Dec 2004

    Posted 02 May 2013 Link to this post

    Hi,

    We've bougth our licence and there is no error anymore but the selected values are not shown in the multiselect...

    I've posted a ticket in the support.

    Best regards,
  7. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 05 May 2013 Link to this post

    Hello,

     
    As I pointed in the support thread, you will need to update javascript files, css files and the DDL. Check this help topic for more information.

    Kind regards,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top
UI for ASP.NET MVC is VS 2017 Ready