您的位置:首页 > Web前端 > JavaScript

js Array to C# List<Dictionary>(js 传参 自定义类列表 到C#)

2014-08-25 15:58 363 查看
前端:

@model ZACF.Site.Mvc.ViewModels.My.InterestAutoCashList
<div class="AutoCashList">
<table>
<tr>
<th width="20%;" style="font-weight:lighter;"><input type="checkbox"/> 全选</th>
<th>月息宝</th>
<th width="20%">自动提现</th>
</tr>
@foreach (var item in Model.AutoCashList)
{
<tr>
<td><input type="checkbox" value="@item.ID"/></td>
<td>@item.OrderId</td>
<td>@(item.IsAutoCash == "01" ? "已开启" : "已关闭")</td>
</tr>
}
</table>
<div style="margin-top:30px;">
<input id="btnOpen" type="button" value="开启"/>  
<input id="btnClose" type="button" value="关闭"/>
</div>
</div>
<script type="text/javascript">
$("#btnOpen").click(function () {
var list = new Array();
$(".AutoCashList table td").find("input[type='checkbox']").each(function () {
list.push({ interestUserId: $(this).val(),isChecked:$(this).prop("checked"),oldChecked:$(this).next("td").html()});
});
$.ajax({
url: "/My/InterestAutoCashOpen",
data: { listData: list },
type: "post",
success: function (data) {

}
});
});
</script>

服务端:

public ActionResult InterestAutoCashOpen(List<Dictionary<string,string>> listData)
{
foreach (var item in listData)
{
string interestUserId = item["interestUserId"];
bool isChecked = bool.Parse(item["isChecked"]);
。。。
}
return 。。。
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐