Search code examples
asp.net-mvc-4c#-4.0drop-down-menuasp.net-mvc-5razor-2

How to create dropdownlist with static and dynamic values in Asp.net MVC with a divider between them


I want to create a dropdownlist which have three static values: Select All, Text Only, Numeric only. After that I like to add a line with some padding (just to separate these options) and then add some dynamic options.

I am not sure how to do this, Can some body please help?

So far I have created a List<SelectListItem> in my view model, and populated the static values from BLL. But I am not sure how to add a divider line in the middle now, and append some dynamic options after that.

Thanks


Solution

  • The normal select tag will not work like that, you will have to create custom dropdown using spans or divs.

    See some examples here:

    http://tympanus.net/codrops/2012/10/04/custom-drop-down-list-styling/