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

Set selected items from viewmodel

5 Answers 182 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Shane P
Top achievements
Rank 1
Shane P asked on 16 Apr 2013, 10:27 AM
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

5 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 17 Apr 2013, 07:10 AM
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!
0
Jonathan
Top achievements
Rank 1
answered on 26 Apr 2013, 11:21 AM
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
0
Georgi Krustev
Telerik team
answered on 30 Apr 2013, 07:06 AM
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!
0
Info Expert-IT
Top achievements
Rank 1
answered on 02 May 2013, 09:15 AM
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,
0
Georgi Krustev
Telerik team
answered on 05 May 2013, 08:35 AM
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!
Tags
MultiSelect
Asked by
Shane P
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Jonathan
Top achievements
Rank 1
Info Expert-IT
Top achievements
Rank 1
Share this question
or