In my first venture into ASP.NET MVC, I am coming across a few situations where I have dropdown lists that are limited in their purpose to a single view. A good example is that I have a signup form where a user has to put in their gender and birthdate. Once entered, nowhere in the application is it changed.
For the gender, I build out the genders and for the birthdate, I build out the individual peices (months, days, and years) for their respective dropdowns. Now, I have the methods that generate these values in the controller that returns this view (in the constructor). I just can't help but to think that there is a bit of a code smell coming from doing it this way, though, since not every method in the controller will always return the view (possibly because of REST-ful calls, etc.). I don't think that generating these every time is the approach to take.
What methods to people use to mediate this? I am thinking some sort of a class with static methods that can be called directly from the assignment (<%= Html.Dropdown("myitem", GeneratorMethod()) %>). The only problem that I can forsee out of doing it this way is being able to figure out how to re-select an item in the event the view is returned again (due to a validation error, for example).
Any feedback would be appreciated!