asp.net mvc - Should the model be responsible for holding lists that will ultimately populate dropdownlists in the view? -


this might similar asp.net mvc - populate commonly used dropdownlists.

i want populate dropdownlists. of static data. of comes database. couple of times found myself forgetting call code populates lists , sets viewbag accordingly. worth adding unit test this. way think suits unit test if place in model/service. there best practice kind of thing?

i'd suggest data contained within model perhaps constructed html.helper method. way, keep plumbing markup out of view , leave controller free invoke neccesary view , model.

you of course hand off partialview <ilist<selectlist>> model.

cats , skin :)


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -