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

The Archive Base Latest Questions

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

I am trying to solve the following problem. Lets say you have the the

  • 0

I am trying to solve the following problem.

Lets say you have the the following code in your view

@foreach (var x in Model)
{
    <input type="checkbox" name="IDs" value="@x.ID"  /> 
}

The user then makes bunch of selections clicks some link. How do pass the the ids of the selected check boxes to the controller.

e.g you have the following link

@Html.ActionLink("Do Something", "ActionName", new { selection = ???? // i dont know how i reference the checke boxes })

I know I can put the loop in a Html begin form and make the link a submit button but this is an abstract of the problem i am trying to solve. In the actual application i cannot convert the link to button.

I would prefer not to use JavaScript if possible.

  • 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-05-31T18:11:09+00:00Added an answer on May 31, 2026 at 6:11 pm

    I do not know that there is a way to do this with typical MVC helpers. What I have done in the past is created the link so that it’s onclick called a custom jquery function that would select all of the inputs with type checkbox who are selected, and then create a list to be sent back.

    Something like this:

    $(
        $('#anchorid').click(function()
            {
                SubmitCheckBoxes();
            });
    );
    
    function SubmitCheckBoxes()
    {
        var list = {};
        $(input[type="checkbox"]:checked).each(
            function() 
            {
                var identifier = $(this).attr('for');
                if(identifier == undefined)
                    identifier = $(this).attr('name');
                if(list[identifier])
                    list[identifier].push($(this).val());
                else
                    list[identifier] = [$(this).val()];
            });
        //This must be here to make any json array not have brackets.
        //MVC binding will not work otherwise
        jQuery.ajaxSettings.traditional = true;
        $.post("./ActionName", list, function(data){//do something on response});
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to solve the following problem: Say I have a Python script (let's
I'm trying to solve the following problem: Given an input of, say, 0000000000000000 0011111111110000
I'm trying to solve the following problem in Redis. I have a list that
I am trying to solve the following problem with Puppet: I have multiple nodes.
I have the following cyclic dependency problem I am trying to solve: typedef std::map<int,
I have the following problem which I'm trying to solve with javascript. I have
I am trying to solve the following problem. Assume I have a HTML file
I'm trying to solve the following problem: I have a download button that when
I'm trying to create an algorithm to solve the following problem: Input is an
I'm trying to solve the following real-life problem you might have encountered yourselves: You

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.