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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:15:08+00:00 2026-05-11T12:15:08+00:00

Crazy issue with submitting of values in Html.Checkbox in ASP.NET MVC RC Some of

  • 0

Crazy issue with submitting of values in Html.Checkbox in ASP.NET MVC RC

Some of the values are just not come to Request.Params

At my form I have this line inside the cycle:

<%=Html.CheckBox('cb' + p.Option.Id, p.Option.IsAllowed, new { value = 6 })%>

and it renders to next:

    <input checked='checked' id='cb17' name='cb17' type='checkbox' value='6' /> <input name='cb17' type='hidden' value='false' />       <input checked='checked' id='cb18' name='cb18' type='checkbox' value='6' /> <input name='cb18' type='hidden' value='false' />       <input id='cb19' name='cb19' type='checkbox' value='6' /> <input name='cb19' type='hidden' value='false' />      <input id='cb20' name='cb20' type='checkbox' value='6' /> <input name='cb20' type='hidden' value='false' />      <input checked='checked' id='cb21' name='cb21' type='checkbox' value='6' /> <input name='cb21' type='hidden' value='false' />  

After submitting the Form I’m get something like:

Form.Params['cb17'] = {6, 'false'} Form.Params['cb18'] = {6, 'false'} Form.Params['cb19'] = {'false'} Form.Params['cb20'] = {'6,false'} Form.Params['cb21'] = {'false'} 

In the request string Some of the params are displayed twice (normal situation) and some only ONE TIME (only value of hidden field). It seems that it doesn’t rely on whether checkbox was checked or not, whether value has changed or so…

Does anybody faced with such a situation? How can I work around?

  • 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. 2026-05-11T12:15:08+00:00Added an answer on May 11, 2026 at 12:15 pm
       <% using(Html.BeginForm('Retrieve', 'Home')) %>//Retrieve is the name of the action while Home is the name of the controller        <% { %>     <%foreach (var app in newApps)              { %>     <tr>         <td><%=Html.CheckBox(''+app.ApplicationId )%></td>           </tr>   <%} %>  <input type'submit'/> <% } %> 

    and in your controller

     List<app>=newApps; //Database bind  for(int i=0; i<app.Count;i++)  {      var checkbox=Request.Form[''+app[i].ApplicationId];     if(checkbox!='false')// if not false then true,false is returned  } 

    the reason you check for false because the Html Checkbox helper does some kind of freaky thing for value true

    True returns as:

    it makes the string read 'true, false' 

    so you may have thought it was two values but its just one and means true

    False returns as:

    it makes the string read 'false' 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was expreimenting to build a page editor. One issue just drove me crazy
Am I just going crazy, or does background-attachment:fixed; really not work in the native
I'm struggeling with an issue that really drives my crazy. I found comparable issues
so I am having this issue that has been driving me crazy for hours,
We were faced with very strange issue that made us crazy. Sometimes newly created
Not crazy about the way Xcode 4.2 has laid out the files on disk.
I'm getting crazy with this problem: I have got some Oracle SQL-Reports to redesign
This is driving me crazy... With this simple code I keep getting file not
This is driving me crazy. I have a PHP script that gets some data
This issue/quirk/side-effect is driving me crazy. Near the bottom the code, the response code

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.