Listbox bind to model view

7 posts, 0 answers
  1. Nouman
    Nouman avatar
    7 posts
    Member since:
    Jun 2017

    Posted 15 Aug Link to this post

    Tag helpers in a form allow the following:

    https://docs.microsoft.com/en-us/aspnet/core/mvc/views/working-with-forms

    @model CountryViewModel

    <form asp-controller="Home" asp-action="Index" method="post">

    <select asp-for="Country" asp-items="Model.Countries">

    </select>

    <br />

    <button type="submit">Register</button>

    </form>

     

    How do I accomplish the same thing with Kendo Listbox?

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2086 posts

    Posted 18 Aug Link to this post

    Hi Nouman,

    You could bind the model to the ListBox helper as shown below:
    @(Html.Kendo().ListBox()
                .Name("myListBox1")
                .HtmlAttributes(new { title = "Some title"})
                .BindTo(Model.Countries)
                .Selectable(ListBoxSelectable.Multiple)
            )

    Hope this helps.


    Regards,
    Konstantin Dikov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Nouman
    Nouman avatar
    7 posts
    Member since:
    Jun 2017

    Posted 21 Aug in reply to Konstantin Dikov Link to this post

    Hi Konstantin,

     

    Thank you for your reply.  

     

    Does Kendo have a ListBoxFor similar to @Html.MultiSelectFor?

  4. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2086 posts

    Posted 24 Aug Link to this post

    Hello Nouman,

    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:

    Best Regards,
    Konstantin Dikov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Nouman
    Nouman avatar
    7 posts
    Member since:
    Jun 2017

    Posted 24 Aug Link to this post

    Konstantin,

     

    Thanks again for this information.  MultiselectFor may work for us, especially since this widget can be customized.  We can close this issue for now and I will post again if I run into any issues customizing the look using item template.

  6. Coy
    Coy avatar
    6 posts
    Member since:
    May 2013

    Posted 2 days and 16 hours ago Link to this post

    I'd also be pleased with Model Binding for ListBoxFor.

     

    Upvoted!

  7. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2086 posts

    Posted 1 minute ago Link to this post

    Hello Coy,

    Could you please give your vote in the following public item, so you could increase its priority:

    Best Regards,
    Konstantin Dikov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top