jquery easyui中gridview用getData获取显示的所有数据
前台(提交方法):
$("#btnQueDing").click(function () {
var rows = $(‘#dg‘).datagrid(‘getData‘);
if ($("#iptZiDingYiMuBanMingCheng").attr("value") == "") {ZhongWenMingCheng
$.messager.alert(‘警告‘, ‘请先填写模板名称!‘);
return;
} else {
$.ajax({
type: "POST",
url: "/KaoHeMuBan/AddZiDingYiMuBan?MingCheng=" + $("#iptZiDingYiMuBanMingCheng").attr("value") + "&MuBanLeiXing=" + $(‘#selZiDingYi‘).combobox(‘getText‘) + "&BeiZhu=" + $("#ZiDingYiBeiZhu").attr("value") + "&LieLeiXing=" + JSON.stringify(rows.rows),
//data: "MingCheng=" + $("iptZiDingYiMuBanMingCheng").attr("value") + "&MuBanLeiXing=" + $(‘#selZiDingYi‘).combobox(‘getText‘) + "&BeiZhu=" + $("#BeiZhu").attr("value") + "&LieLeiXing=" + dgdata,
success: function (msg) {
ShuaXin();
$.messager.alert(‘提示‘, msg);
}
})
}
})
后台接收方法:
public class ccccccc
{
public string ZhongWenMingCheng { get; set; }
public string KaoPingXiangLeiXing { get; set; }
}
public string AddMuBan(string LieLeiXing)
{
try
{
#region MyRegion添加
List<ccccccc> jsonlist = new List<ccccccc>();//实例化
List<MuBan> listxm = JsonConvert.DeserializeObject<List<MuBan>>(LieLeiXing);//json反序列操作
for (int i = 0; i < listxm.Count; i++)
{
MuBan ximu = new MuBan();
ximu.MingCheng= listxm[i].MingCheng;
ximu.LeiXing = listxm[i].LeiXing;
tmbxmBLL.Insert(ximu);//添加方法
}
return "添加成功";
#endregion
}
catch
{
return "添加失败";
}
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。