Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3957898
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:32:49+00:00 2026-05-20T02:32:49+00:00

Something I am struggling with, more philosophically I suppose, is whether DropDownList items (or

  • 0

Something I am struggling with, more philosophically I suppose, is whether DropDownList items (or really any kind of selection list items) should be part of the model, or if they should be hard coded into the UI or business-layer. Or perhaps this is a good use of the ViewModel?

For some kinds of dropdownlists, you obviously have to make them part of the model. For instance, a dropdownlist of order id’s associated with a customer will have to be generated by the model.

Other kinds, which I would refer to as “lookup” data are less clear to me. Gender, for instance. Why force a round trip lookup to populate a field with 2 items? Perhaps this is premature optimization, but if you have 50 fields, that’s a lot of round trips just to populate one page. Certainly, cacheing might come in handy there, but it seems kludgy.

I also worry that adding all these lookup lists to the model will unnecessarily clutter it. Especially if you have a lot of them.

There is also the option of not hard coding in the UI, but hard coding in the business layer. Possibly even making a class that does nothing but populate this data.

If the answer is, you should still make them part of the data model, then there is the problem of whether your datamodel should have a different table for each set of lookup fields. If your data model has 200 or 300 such fields, that’s 200 or 300 tables, and that really makes maintaining your data model more complex.

I asked a question about having a common lookup table a while back, and the consensus was that this was a bad idea. But for very data heavy applications where there are a lot of fields, i find myself doubtful.

Now, I know many of you will say “It depends”, but i’m looking at a “in general” kind of answer. In general, what is the rule of thumb here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:32:50+00:00Added an answer on May 20, 2026 at 2:32 am

    I’ve been participating in building one system with a lot of dictionaries. Most of them were stored in one simple table, which contained id of dictionary, id of item, its name and some other basic values. Some of the items in this table had predefined ids (for example male = 1001, female = 1002), so if table had gender_id field, I didn’t have to make a lookup in dictionary table to search male, I knew its id. These ids were still defined in code as constants, but for presentation purposes, they were taken from database. It worked well and performance was not bad (hunderds of dictionaries, thousands of items). They could be passed to view in view model. View model for editing person could look like:

    public class PersonViewModel {
        public Person Person { get; set; };
        public SelectList Genders { get; set; };
        public SelectList Departments { get; set; };
        public SelectList Positions { get; set; };
    }
    

    You could populate view with code:

    Genders = DictionaryService.GetDictionary(Dictionaries.Genders);
    Departments = DictionaryService.GetDictionary(Dictionaries.Departments);
    Positions = DictionaryService.GetDictionary(Dictionaries.Positions);
    

    where Dictionaries is enum.

    In DictionaryService.GetDictionary() method you can introduce some kind of caching.

    If you want to populate dropdown, that can have unlimited number of items (for fields, that have reference to other tables, that grow a lot in time), use some kind of incremental search with dynamically (ajax) loaded items.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling with something that I expect should be fairly straightforward! - is it
This is something I've been struggling with theoretically, but haven't found any good answers
I'm always struggling with something like the following Java example: String breads[] = {Brown,
I'm struggling to combine nohup, open_init_pty and sudo in a one-liner. Something like this:
Here’s a problem I’ve really been struggling with. I need to merge two sorted
I'm struggling to understand something about GIT. We've got a repository with a number
Being new to iPhone development I am really struggling with this concept. I have
I'm struggling with something quite simple, but I'm going around in circles, and just
I'm struggling to read query variables that contain more than 512 characters in the
I'm struggling with the idea of how to build an expression tree for more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.