简体   繁体   中英

ASP:Checkbox Bind Issues

I am using a MSsql Database and trying to bind a checkbox to one of the fields. The field in the DB is a Bit so it is looking for a 1 or 0, but the asp:checkbox deals with Boolean values. How do I go about doing this binding?

如果从数据库返回的值是int类型,那么用户Convert.ToBoolean

0 is false and 1 is true, if that helps.

Otherwise - what ORM are you using? It should surface bit columns as .NET bool properties.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM