如何将选定的复选框值传递给actionlink? [英] How to pass selected checkbox values to actionlink?
问题描述
我想将数据表的选定复选框值传递给actionlink。我有一个数据表,我在显示所有请求。我想为每个请求下载一个pdf文件。所以想要将请求的ID传递给actionlink。我有代码:
$( .check_all)。click( function (){
alert( 嗨);
var requestedFormat = $( input [name = format]:选中)。val();
var list = [];
$(' input [name = chkRequest]:选中')。each( function (){
list.push($( this )。val());
// alert($(this)。 val());
});
alert(list);
要选择复选框id,我存储它列表变量。我再次拥有CSHTML代码:
@ Ajax.ActionLink( 内部使用, DownloadrequirementsInternalUse, 请求, new {Id = list,@area = RMG}, null )
如何将选中的复选框列表传递给控制器?请帮忙。
我的尝试:
我已经尝试过上面提到的代码。但无法将所选值传递给actionlink。
( .check_all)。click( function (){
alert( 嗨);
var requestedFormat =
( input [name = format]:checked)。val();
var list = [];
(' input [name = chkRequest]:选中')。each( function (){
list.push(
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:
$(".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:
@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.
(".check_all").click(function () { alert("Hi"); var requestedFormat =
("input[name=format]:checked").val(); var list = [];
('input[name=chkRequest]:checked').each(function () { list.push(
这篇关于如何将选定的复选框值传递给actionlink?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!