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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:08:18+00:00 2026-06-01T05:08:18+00:00

This is My View: @foreach(var action in Model.Category.Actions) { <div class=action style=margin-right: 30px;> <input

  • 0

This is My View:

@foreach(var action in Model.Category.Actions) {
<div class="action" style="margin-right: 30px;">
    <input type="checkbox" class="chk-act" id="@action.Id" name="actionChk" />
    <text>@action.Text</text>
</div>
  }

And html Dom is like the followings:

<input type="checkbox" class="chk-act" id="17" name="actionChk">
<input type="checkbox" class="chk-act" id="18" name="actionChk">
<input type="checkbox" class="chk-act" id="19" name="actionChk">

So I need to get checked Ids. When I try to get values by form collection, that returned me an string array of on by length of checked checkboxes:

[HttpPost]
public ActionResult Index(FormCollection collection) {
    var actions = collection.GetValues("actionChk");
return View();
}

what is your suggestion?

  • 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-01T05:08:19+00:00Added an answer on June 1, 2026 at 5:08 am

    You should put the values in the value parameter

     <input type="checkbox" class="chk-act" id="17" value="17" name="actionChk">
     <input type="checkbox" class="chk-act" id="18" value="18" name="actionChk">
     <input type="checkbox" class="chk-act" id="19" value="19" name="actionChk">
    

    Then, from the controller, you should have an array of Ids named actionChk

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

Sidebar

Related Questions

If I'm in my view getting collection of images like this foreach (var item
View this code: function testprecision(){ var isNotNumber = parseFloat('1.3').toPrecision(6); alert(typeof isNotNumber); //=> string }
I have a really strange ‘bug’. I use this in my view: <% foreach
I have problem with update listbox from view model class. I use Caliburn Micro
This is how I populate the view from the viewmodel PersonInformation.. @model Client.Models.PersonInformation <fieldset>
I created a new View (LogView) in Infrastructure.Module project. This view will be used
I have a Django view called change_priority. I'm posting a request to this view
I have a view ViewUserControl<SearchViewData> where SearchViewData: CommonViewData In this view I thus have
I got a view that inherits : System.Web.Mvc.ViewPage<IEnumerable<MyProjects.Models.MyAccountWrapper>> In this view I list data
I'm having a memory problem related to UIImageView. After adding this view to my

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.