html - How to select an option in dropdown list htmlhelper -


i have enum this.

public enum weekday {     monday,     tuesday,     wednesday,     thursday,     friday,     saturday,     sunday } 

and i'm using in htmlhelper

@html.dropdownlistfor(model => model.day,    new selectlist(enum.getvalues(typeof(weekday))),    "select day",    new { @class = "form-control" }) 

how can make dropdown list select 1 of days instead of showing "select day"?

try

 @html.dropdownlistfor(model => model.day, new  selectlist(enum.getvalues(typeof(weekday))), null, new { @class = "form-control" }) 

this result in selecting first entry in list. in case monday


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -