better binding support for checkbox lists!
binding checkboxes is still a pain. I'd like to be able to bind a control to an IEnumerable of items and not worry about it anymore.
I would like to see out-of-the-box Scaffolding support for CheckBox Lists, RadioButton Lists and DropDown List controls. In addition, this item is very similar to this request:
Shaify Mehta commented
yes, Really we need this :)
nanda kumar commented
I am 100% agree with you. I am binding child objects to UI. the name of the check boxes are "JobOrder.JobOrderDeliverables.JobOrderDelivTranscript.TranscriptType.id" and JobOrder.JobOrderDeliverables.JobOrderDelivTranscript.TranscriptType.id
in case i am not checking the first check box, nothing will be transferred to the controller. because index zero is missing in the name. Now i am doing some workarounds like i am re-arranging the name of the checked checkbox when i am submitting the form. I am looking for the better data-bind from mvc4
Franco Roberto Bernardo Dos Santos commented
And also for radio button list. I know you can do it by "hand" it just feels dirty to call helpers for everything and then start "hacking" around with IDs and names.
Html.DropDownListFor(m => m.SelectedProperty, Model.SelectList) helper ignores the selected value of the SelectList. This should also be fixed.
Is this really such a pain? Can't believe this is so popular? Why not go back to asp.net webforms :) for the game changing timesaving power of such beauties as <asp:CheckBoxList ? Or just take 20 mins to roll your own?
Scott Galloway commented
I just had to manually code a solution for a checkbox group and was thinking this very same thing.
Andreas Kroll commented
Have a look at knockout.js
You can have your data as viewmodel on the client and even have the option to iterate over arrays using jQuery templates to create the html code from the datamodel.
I think I saw a sample of that on the knockout.js homepage.
Marius Schulz commented
Wish I had more than 3 votes to support this feature ...