Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to pass the selected checkbox values of the datatable to the actionlink. I have a datatable where I am displaying all the requests. I want to download a pdf file for each of the request. So want to pass the ids of the requests to the actionlink. I have the code:

JavaScript
$(".check_all").click(function () {
        alert("Hi");
        var requestedFormat = $("input[name=format]:checked").val();
        var list = [];
        $('input[name=chkRequest]:checked').each(function () {
            list.push($(this).val());
            //alert($(this).val());
        });
        alert(list);


To select the checkbox ids, I am storing it in the list variable. Again I have CSHTML code:

C#
@Ajax.ActionLink("Internal Use", "DownloadrequirementsInternalUse", "Request", new { Id = list, @area = "RMG" }, null)



How to pass the selected checkbox list to the controller? Please Help.

What I have tried:

I have tried the code mentioned above. but not able to pass the selected values to the actionlink.
Posted
Updated 6-Apr-16 3:41am

1 solution

Hello Rakesh

you should read this documention for proper understanding of correct syntax . I hope you will get proper use of @ajax.ActionLink


AjaxExtensions.ActionLink Method (System.Web.Mvc.Ajax)

AjaxOptions Class (System.Web.Mvc.Ajax)



for your information to pass list of data (object type) to your controller you have to serialize data before sending it.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900