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

Another MultiSelect hiccup

1 Answer 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Talal
Top achievements
Rank 1
Talal asked on 09 May 2015, 08:34 AM

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.

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 13 May 2015, 06:57 AM
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.

Regards,
Georgi Krustev
Telerik
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
Tags
General Discussions
Asked by
Talal
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or