Javascript代码:
toolbarEvent.onNew = function () {
var name = prompt("请输入模板名称:", ""); var items = {}; var indices = []; var selects = $("select[code='drillinginfo']"); for (var i = 0; i < selects.length; i++) { items[i] = new Item(selects[i].id, selects[i].value); } $.post(formatUrl("SelectSubcontractors/OnSaveCondition"), { items: items, standardName:name,saveName: "zzz", conType: cmbconstructiontype.GetValue() }, function (data) { if (data == true) { var msg = new MsgBox("保存成功!"); msg.showModal(); } else { var msg = new MsgBox("保存失败!"); msg.showModal(); } }); }function Item(Code, Value) {
this.Code = Code; this.Value = Value; }C#代码:
public ActionResult OnSaveCondition(List<ExpandoObject> items,string standardName, string saveName, string conType)
{//在上面的List<ExpandoObject> items 接受的就是ajax过来的那个数组。
}