1.前台js代码
$.ajax({
type: "post",
url: ‘AlmMarketScenarioDetailManage.aspx?_method=queryPanel&sernarioId=‘+senarioId,
data: {},
dataType: "json",
success: function (data) {
var inputs = "";
$("#list1").jqGrid("setGridParam", {
datatype: ‘json‘,
postData: { "SenarioId": senarioId, "_method": "querySenario" },
page: 1
}).trigger("reloadGrid");
$("#form1 input").each(function(i) {
var r = $(this).attr("id");
var rt = $(this).attr("class");
if (typeof rt != "undefined"&&rt.indexOf("Mycombox")>=0) {
var r2=r.replace("txt_", "").replace("_", "");
$("#"+r).combogrid(‘setValue‘, data[r2]);
}
if (typeof r != "undefined"&&r.indexOf("txt_")>=0) {
r=r.replace("txt_", "").replace("_", "");
$("#txt_" + r + "_").val(data[r]);
}
});
$("#form1").find("select").each(function(i) {
var r = $(this).attr("id");
if (typeof r != "undefined"&&r.indexOf("txt_")>=0) {
r=r.replace("txt_", "").replace("_", "");
$("#txt_" + r + "_").val(data[r]);
}
});
if (SenarioName == ‘query‘) {
$("#txt_SenarioName_").val($("#txt_Senario_").combogrid("grid").datagrid("getSelected").SenarioName);
} else {
$("#txt_SenarioName_").val(SenarioName);
}
}
});
2.后台代码
case "queryPanel":
QueryInfo tempInfo = new QueryInfo("AlmMarketScenarioDetail");
tempInfo.AddParam("SenarioId", Request["sernarioId"]);
IList tempList = Dao.FindList(tempInfo);
AlmMarketScenarioDetail almMarketScenarioDetail = tempList[0] as AlmMarketScenarioDetail;
almMarketScenarioDetail.CurveDate = almMarketScenarioDetail.CurveDate.Insert(4, "-").Insert(7, "-");
Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(almMarketScenarioDetail));
Response.End();
break;