简体   繁体   English

ASP:Checkbox绑定问题

[英]ASP:Checkbox Bind Issues

I am using a MSsql Database and trying to bind a checkbox to one of the fields. 我正在使用MSsql数据库并尝试将复选框绑定到其中一个字段。 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. DB中的字段是Bit,因此它正在寻找1或0,但asp:checkbox处理布尔值。 How do I go about doing this binding? 我该怎么做这个绑定?

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

0 is false and 1 is true, if that helps. 如果有帮助,则0为假,1为真。

Otherwise - what ORM are you using? 否则 - 您使用的是什么ORM? It should surface bit columns as .NET bool properties. 它应该将bit为.NET bool属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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