We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to use CheckBoxFor with integer instead of boolean

Hi,
in my application I have some DB model, created automaticaly by entity frawework, 
there are integer fields instead of boolean to store true (1) and false (0).
If I use this html helper 

Html.EJ().CheckBoxFor(model=>model.usoInterno).Size(Size.Medium)

get an System.InvalidCastException

It is possible use an Integer value with CheckBox ? How ?

Thanks

3 Replies

BC Berly Christopher Syncfusion Team July 27, 2017 01:27 PM UTC

Hi Nicola, 
 
Thanks for contacting Syncfusion support. 
 
We have checked with your query and we suggest you to use below solution to achieve your requirement (using integer value with checkbox).  
 
 
 
Here we have maintained the Boolean type member which will convert to/from integer to bool. 
 
Also, please refer below forum link to know more about this, 
 
 
 
Regards, 
Berly B.C 
 



NI Nicola July 31, 2017 01:26 PM UTC

Thanks



BC Berly Christopher Syncfusion Team August 1, 2017 02:57 PM UTC

Hi Nicola,

Thanks for the update. We are happy to hear that the issue is resolved at your end. Please get back to us if you need any further assistance on this.

Regards,

Berly B.C
 


Loader.
Live Chat Icon For mobile
Up arrow icon