Another MultiSelect hiccup

2 posts, 0 answers
  1. Talal
    Talal avatar
    3 posts
    Member since:
    Apr 2015

    Posted 09 May 2015 Link to this post

    I am using a multi select to display products a client have and want him/her to be able to select from all available products. The problem is, Only when I specify the collection of user's products in MultiSelectFor(m=>m.Products) and also .BindFor(Model.Products), only then I get the list of products selected in the multiselect. Bu I want MultiSelectFor(m=>m.Products) where products contains all user's products and when I call an action method, I want that property to contain the updated product list, i,e products currently selected in the Multiselect, i,e a user can remove or add to the products in the Products collection.

  2. Georgi Krustev
    Georgi Krustev avatar
    3747 posts

    Posted 13 May 2015 Link to this post

    Hello Talal,

    In general, the selected values of the widget can be a list of primitive values (strings, ints and etc), because the underlying HTML Select element can post only selected values and not objects. There are two possible ways to send the selected objects/items back to the server:
    • Post the selected values of the widget (only the primitive values) and based on them you can get the whole objects on the server.
    • Post the selected data items using jQuery.ajax. You can retrieve the selected data items using dataItems method.
    If you would like to use the first approach, where the data is posted with regular HTML Form element, then I would suggest you accomplish your goal using built-in Html.ListBox extension. Once you acchieve your business goals with it, I will gladly assist you replace the widget using the multiselect.

    Georgi Krustev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top