Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a pattern I can use to edit dropdown lists in an MVC3 application?

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.

like image 702
ProfK Avatar asked Feb 01 '12 20:02

ProfK


1 Answers

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.

like image 85
kprobst Avatar answered Nov 15 '22 06:11

kprobst