Unplanned
Last Updated: 01 Sep 2021 12:40 by ADMIN
Nouman
Created on: 30 Aug 2017 18:03
Category: ListBox
Type: Feature Request
32
ListBoxFor similar to MultiSelectFor
Although that the ListBox is similar to the MultiSelect, at the moment it does not have such model binding, because it is also comparable with the data management widgets and for the initial release of the ListBox our developers decided to consider the model binding only if there is demand for it. With that in mind, you could create a feature request in our public portal for that feature: 

http://www.telerik.com/forums/listbox-bind-to-model-view
7 comments
ADMIN
Anton Mironov
Posted on: 01 Sep 2021 12:40

Hello Martin,

Thank you for your feedback. Our Dev Team will have it in mind if this idea is going to be implemented.

Regards,
Anton Mironov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Martin
Posted on: 25 Aug 2021 16:33
Should be done to remain consistent with other controls - including AJAX support (with updated, create, delete).
ADMIN
Alex Hajigeorgieva
Posted on: 10 Sep 2020 12:21

Hello,

While the Kendo UI ListBox does not have the necessary bindings, it is possible to use it as an editor with the following approach which will bind the Locations thanks to the data_bind attribute and will act in the same way as MultiSelectFor(x=>x.Locations) including saving the new collection in the model.Location property and posting it together with the full model on update:

 .Columns(columns =>
{     // grid column bound to a collection
      columns.Bound(p => p.Locations).ClientTemplate("#= getTemplate(data) #");


// Custom popup editor contains the Locations Listbox
@(Html.Kendo().ListBox()
  .Name("Locations")
  .DataValueField("Id")
  .DataTextField("Name")
  .ConnectWith("Available")
  .HtmlAttributes(new { data_bind = "source:Locations" })
  .Selectable(ListBoxSelectable.Multiple)
)


function getTemplate(data) {
        if (data.Locations.length) {
            var template = "<ul>";
            $.each(data.Locations, function (idx, location) {
                template += "<li>" + location.Name + "</li>"
            });
            template += "</ul>";
            return template;
        }
        return "";

    }

I am attaching a runnable project here, just include a reference to the Kendo.Mvc.dll, build and run.

The same project is also available for ASP.NET Core here:

https://github.com/telerik/ui-for-aspnet-core-examples/blob/master/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Views/Grid/ListBoxAsEditor.cshtml

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Attached Files:
Aaron
Posted on: 04 Sep 2020 13:48
Update: see my post here for more information on what seems to be causing issues with model binding when doing a POST back to the server, as well as potential workarounds.
Aaron
Posted on: 03 Sep 2020 16:19
Can someone from Telerik provide anymore feedback on this (ex. maybe potential workarounds)? Is there anything in particular that makes implementing this somewhat unfeasible? I would almost be willing to implement my own workaround for this, but the fact that it still hasn't gained "official support" and been implemented makes me a bit nervous (ex. do I really want to attempt the second-most upvoted "unplanned" feature request that not even the Telerik devs want to touch?).
Brent
Posted on: 17 Oct 2019 19:55
In my opinion, this is a must have feature. The ListBox controls are just what I want to use copy items from one listbox to another, and then with a lot of other information, post my form to an Action. I can't believe this isn't implemented.
John
Posted on: 20 Apr 2018 21:13
I would have used it.  Seems strange that it's missing.