Click here to Skip to main content
15,889,876 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to add a drop-down to one of my view on MVC and it should send either 0 or 1 to database. What data-type should i select in database so as to make it to accept only 0 or 1. And most importantly how to create that drop-down on my view. Please help!!!
Posted

1 solution

You can use tinyint[^] or char[^] to store 0 and 1. An alternate could also be to use a bit[^] type.

Here are some examples on create a dropdownlist in a view -
DropDownList / Basic usage [^]
DropDownListFor with ASP.NET MVC[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900