Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 684999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:52:40+00:00 2026-05-14T01:52:40+00:00

The field the CheckBox is wired to is nullable. On my view I get

  • 0

The field the CheckBox is wired to is nullable.

On my view I get the following error:

Cannot implicitly convert type ‘bool?’
to ‘bool’

<%= Html.CheckBoxFor(model => model.Product.Exclusive) %>

How do I fix it without having to change the database design?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:52:40+00:00Added an answer on May 14, 2026 at 1:52 am

    Exclusive cannot be Nullable, it makes no sense to the ViewEngine when evaluating the expression. It has to either check or not check the checkbox and also respond with a true or false value. Your model needs to have a bool value but that doesn’t mean your database has to know that. You just have to do a translation somewhere between the database and the Model, eg. Model.Exclusive = DAO.Exclusive ?? false.

    Without knowing what null represents in your data schema or how you generate your model objects, it’s hard to give you a lot more detail than that.

    Edit: haven’t tested this but you might get away with something as simple as

    public bool NoNullExclusive
    {
        get { return Exclusive ?? false; }
        set { Exclusive = value; }
    }
    

    and replacing

    <%= Html.CheckBoxFor(model => model.Product.Exclusive) %>
    

    with

    <%= Html.CheckBoxFor(model => model.Product.NoNullExclusive) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Word.Field object which is a checkbox and the Type property equals
Following situation: I stored a checkbox array with implode in a mysql table field.
I have this form: <tr> <td><input type=hidden name=ledlamps value=LED lamps>LED lamps:</td> <td><input class=field checkbox
By default, Zend_Form creates a hidden input field for each checkbox input in the
Is accessing a bool field atomic in C#? In particular, do I need to
So I have a gridview with a checkbox field. In jquery, I'd like to
I have a form field/checkbox and am unable to pass the boolean value even
Is there a way to retrieve whether a Checkbox field is checked in a
$('[name^=field_][type=checkbox]'); Above gives the list of checkboxes with name that start with field_ .
I have a gridview control with a checkbox field and several bound fields. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.