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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:01:48+00:00 2026-06-07T16:01:48+00:00

if I have this html checkbox list code, how in mvc in my post

  • 0

if I have this html checkbox list code, how in mvc in my post action method how can I get the Id of that checkboxlist? because whith string[] dias i get just the values by example(“lunes” “martes” … etc)

(usgin this example for make my checkboxlist => example)

[HttpPost]
        public ActionResult Editar(cliente cliente, string[] dias)
        {
         }

html

<input id="1" type="checkbox" value="Lunes" name="dias">
Lunes
<input id="2" type="checkbox" value="Martes" name="dias">
Martes
<input id="3" type="checkbox" value="Miercoles" name="dias">
Miercoles
<input id="4" type="checkbox" value="Jueves" name="dias">
Jueves
<input id="5" type="checkbox" value="Viernes" name="dias">
Viernes
<input id="6" type="checkbox" value="Sabado" name="dias" checked="checked">
Sabado
<input id="" type="checkbox" value="Domingo" name="dias">
Domingo 
  • 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-07T16:01:49+00:00Added an answer on June 7, 2026 at 4:01 pm

    You can’t get the id. The id attribute is never sent to the server when you submit an form. That’s how HTML works. Only the value is sent. But checkboxes are a little different because only the value attribute of the checked checkboxes is sent to the server.

    So, simply use the value attribute for that purpose:

    <input id="1" type="checkbox" value="1" name="dias">
    Lunes
    <input id="2" type="checkbox" value="2" name="dias">
    Martes
    <input id="3" type="checkbox" value="3" name="dias">
    Miercoles
    <input id="4" type="checkbox" value="4" name="dias">
    Jueves
    <input id="5" type="checkbox" value="5" name="dias">
    Viernes
    <input id="6" type="checkbox" value="6" name="dias" checked="checked">
    Sabado
    <input id="" type="checkbox" value="" name="dias">
    Domingo
    

    Now in your string[] dias parameter you will get a list of the selected ids. Then if you need to get the corresponding names go ahead and query your data store where they reside given this id.

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

Sidebar

Related Questions

I have an html checkbox that controls a list of checkboxes. I want this
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
In my html.beginform I have this checkbox that I want to persist. I'm not
I have multiple checkbox list that can be selected name=campaign_ids I have a function
I have contact list which contains (checkbox,firstname,lastname,phone). I am creating this list using html
Okay, right now I have a form that contains this select list: <%=Html.LabelFor(x =>
I have this html line: <time itemprop=datePublished datetime=1923-12>December 1923</time> (USA) How can i retrieve
i have this html code <table style=width: 100%;> <tr> <td> ID </td> <td> <input
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have referred this question to learn how to post the checkbox selected values

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.