I am looking for a general, reusable UI pattern I can use for editing the content of dropdown lists in my MVC3 app. That is, some of the Id-Name pairs used to populate dropdowns for edit views exist only for this purpose, and have no dedicated controller-view setup themselves. E.g. Industry and Sector for course modules. Each list is only an Id-Name structure, but Sector has an IndustryId value as well.
Now I really don't want to use the standard scaffolded views for these, i.e. create,edit, and list with links, but I can't help wondering how best to improve on these. Should I bind each list to an editor that just renders a an EditorFor textbox for each item in the list, with jQuery to add a new item or delete an item? is there some established way of doing this?
NOTE: This is not about loading a dropdown list. It's about loading the values for a dropdown list into a view for editing them, to control what appears in the dropdown list when it loads by whatever means.
I don't know if there's a pattern per se, but we deal with this sort of thing as well (dozens of lookup tables with the same structure) and we use simple pages with a jqGrid. The editing is live in the sense that changing a row causes an Ajax call to the controller to modify the lookup value itself. Works fairly well. We ended up having a dedicated view for each of the editable lookup tables (not all of them are) but it would have been simple enough to use the same view, controller and client-side script for all of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With