c# - Turning bit type into a dropdownlistfor -


i have bit type in sql database want turn dropdownlist.

i pass model page has active field. field either true or false. i'm adding ability modify column in database.

is possible create dropdownlistfor give them option of "active" "disable" , return correct value database?

@html.dropdownlistfor(m => m.active, ??)  @model.active  

i have never tried how this:

@html.dropdownlistfor(m=> m.active, new list<selectlistitem>() { new selectlistitem { text = "active", value = "true", selected = model.active }, new selectlistitem { text = "inactive", value = "false", selected = model.active } }) 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -