I am working on an MVC site that is the first my company has done, one of the things I find myself doing a lot is creating selectlists in a controller, putting them in viewdata and reading them when creating a html.DropDownList. theer are a few things that strike me as smelly about the way i do it.
1) some pages can repeat lists of things (the board rate of a hotel room wheer a user can add as many rooms to a hotel as they need), currently i use the same selectlist, is this good practice or should they have one each?
2) with the previous example the "room" is an ascx rendered either by a renderpartial or an ajax call via jquery. what is the best way for the controller to pass the selectlist so the ascx can use it, currently I add to the viewdata for the page, which passes it's viewdata to the renderpartial, but then on the ajax call the action method also needs to add the selectlist to the Viewdata for the ascx, agan not sure this is the best way.
3)I have a repository that holds this "static" data and returns as a generic list, so each time the controller needs the data it hits the repository for the list (there are a few more than just board rate, things like titles for people, mr, mrs etc and others) I suspect some kind of cache would be better as the data rarely if ever changes.
does anyone have any advice in these areas?
thanks P