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.
Unfortunately, activation email could not send to your email. Please try again.

How to use CheckBoxFor with integer instead of boolean

Thread ID:

Created:

Updated:

Platform:

Replies:

131773 Jul 26,2017 09:57 AM Aug 1,2017 10:57 AM ASP.NET MVC 3
loading
Tags: Checkbox
Nicola
Asked On July 26, 2017 09:57 AM

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

Berly Christopher [Syncfusion]
Replied On July 27, 2017 09:27 AM

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 
 


Nicola
Replied On July 31, 2017 09:26 AM

Thanks


Berly Christopher [Syncfusion]
Replied On August 1, 2017 10:57 AM

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
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;