I would like the ability to add Html attributes to individual SelectListItems via object htmlAttributes. This would be handy for applying CSS to selected options on render. I have working code for this (using the MVC3 source as the base) that I have used on client websites so it will be easy to integrate.
Comments: This is a great idea, but it can be even better with another overload that instead of just adding data attributes for every SelectListItem, consider adding a function as the parameter that can generate whatever parameter you want to based on the return value of the function. That way you can put together a nice lambda expression that returns a data attribute depending on the value or text of the SelectListItem.
Comments: This is a great idea, but it can be even better with another overload that instead of just adding data attributes for every SelectListItem, consider adding a function as the parameter that can generate whatever parameter you want to based on the return value of the function. That way you can put together a nice lambda expression that returns a data attribute depending on the value or text of the SelectListItem.