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 530915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:14:47+00:00 2026-05-13T09:14:47+00:00

in asp.net mvc, it seems like checkboxes bind to array of strings (if they

  • 0

in asp.net mvc, it seems like checkboxes bind to array of strings (if they are checked). is there any view control that will bind to a boolean in my controller action

 public ActionResult Go(bool isBold)
 {
 }
  • 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-13T09:14:48+00:00Added an answer on May 13, 2026 at 9:14 am

    In your view you can use the Html.CheckBox helper:

    <%= Html.CheckBox("isBold") %>
    

    This will in fact render two HTML input fields:

    <input type="checkbox" name="isBold" value="..." />
    <input type="hidden" name="isBold" value="false" />
    

    This is why it might appear that “bool” binds to arrays of booleans, which isn’t exactly true.

    The reason there are two inputs is that checkboxes that are unchecked post no value at all. That means ASP.NET MVC can’t tell the difference between “this wasn’t posted at all” as opposed to “this was posted but it was not checked.”

    By having two inputs ASP.NET MVC is guaranteed to always get at least one input. Then it just looks at the first. Here’s what happens:

    If the checkbox is checked, it sees “true,false” and picks the first value: true.

    If the checkbox is unchecked it sees “false” and picks the first value: false.

    You can still use other helpers with boolean input values, such as Html.TextBox or Html.DropDownList. The only thing that ASP.NET MVC cares about is that the first posted value with that name either says “true” or “false”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ASP.NET MVC seems to correctly automatically bind between HTML form's file input field and
New to ASP.NET MVC 3. This seems like it should be a really simple
The lack of an EditorFor file in asp.net mvc 3 seems like such a
I'm learning asp.net mvc and found something interesting: It seems that I can't explicitly
I noticed what seems to me a bug in asp.net MVC or simply I
Why do ASP.NET MVC HTML Helpers return MvcHtmlString instances? It seems rather inefficient to
As far as theory goes it seems that Asp.net MVC framework could better be
A controller in my ASP.NET MVC application pre-populates form data displayed by my view
Does anyone have any experience creating a skin engine for asp.net MVC? I know
so i've got an array of numbers that i'm posting to an asp.net mvc

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.