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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:09:03+00:00 2026-06-07T13:09:03+00:00

I have a list of checkboxes on a page, however, their values are not

  • 0

I have a list of checkboxes on a page, however, their values are not getting to the controller.

ListViewModel is where all my models I need in this view. Techniques is a list of Technique from database. Technique has TechiqueID and Type as attributes. tech is a bool array with the same size of techniques types

@model ListViewModel
 @foreach (var item in Model.Techniques ){
                <div>
                    @Html.CheckBoxFor(m => m.tech[item.TechniqueID]) 
                    @item.Type 
                </div>
            }

Any idea why tech[] is null in the controller? It should be on the controller tech[0] = false, tech[1] = false and so on.

Output:

<div>
   <input data-val="true" data-val-required="The Boolean field is required." id="tech_1_" name="tech[1]" type="checkbox" value="true" /><input name="tech[1]" type="hidden" value="false" /> 
   Slippers, Distracting Tasks
</div>
<div>
   <input data-val="true" data-val-required="The Boolean field is required." id="tech_2_" name="tech[2]" type="checkbox" value="true" /><input name="tech[2]" type="hidden" value="false" /> 
   Hallway Placement
</div>
  • 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-06-07T13:09:05+00:00Added an answer on June 7, 2026 at 1:09 pm

    Your problem is that lists of controls need to be 0 based, and sequential. Your first item is based on 1.

    If you need to keep this, then you will need to write a custom model binder for this. An easier solution might be to simply subtract one from the TechniqueID then add it back when you use it.

    Another option would be to add a hidden field with a name of tech[0] and just ignore the first item in the list on post.

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

Sidebar

Related Questions

I have this list of people with checkboxes next to their names. When you
I have list of checkboxes that has all checkbox pre-checked when page load. Firstly,
I have a list of checkboxes in a table like this along with a
I have this long list of checkboxes with specific labels that look something like
I have this long list of checkboxes with specific labels that look something like
Basically, I have a list of delivery checkboxes one for deliver to this address
I have a list of checkboxes. If the page is refreshed before the user
I have a list with checkboxes on a page. Whenever an item is selected
I have a page where I list checkboxes named TimeRange1, TimeRange2.... TimeRange7, and I
I have a mysql/php generated list of checkboxes, all assigned to admins of 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.