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

  • Home
  • SEARCH
  • 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 8937249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:22:24+00:00 2026-06-15T10:22:24+00:00

I have been trying to work out how I can get the list of

  • 0

I have been trying to work out how I can get the list of selected checkboxes to work using an ActionLink. I think I need to do something clientside with JavaScript but cannot find the relevant code.

The following code works perfectly using a submit button, posting back the selected id’s as an array of id’s, but I need to have this on a page with other buttons.

// the view 
@foreach (var station in Stations)
{
   <input type="checkbox" name="selected" value="@station.StationId" /> 
}    
<input type="submit" value="Save" />

//Controller stub
public ActionResult Action(string [] selected) 

I have been stuck on this for hours, so maybe I am looking at this the wrong way.

PS. My first post after many many hours reading and learning here.

  • 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-15T10:22:25+00:00Added an answer on June 15, 2026 at 10:22 am

    Looks like you are not looking for AJAX post. The easiest way to tackle this is to wrap it in the form and call submit function. Here is what your code should look like:

    @using(Html.BeginForm("uraction", "urcontroller", FormMethod.Post, new { id = "formId" })) { 
        foreach(var station in Stations) {
            <input type="checkbox" name="selected" value="@station.StationId" /> 
        }
    }
    <a href="#" id="postBtn">Post</a>
    <script>
        $(document).ready(function() {
            $('#postBtn').click(function() {
                $('#formId').submit();
            }
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get it to work using this thread but can't
I have been trying to get this to work correctly and I think I
I have been trying everything I can to get this script to work and
Okay I been trying to work this out but unable too. I have a
I have been pulling my hair out trying to make this work. I have
I have been trying to get nServiceBus to work with Ninject 2.0 as the
I have been trying to get this jsfiddle to work. So far without luck.
I have been trying to get Twitter Bootstrap btn-group with dropdown to work for
This is crazy, I have been trying for hours to get this to work.
I have had been on a roller coaster trying to get ImageMagick to work

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.