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

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -