码迷,mamicode.com
首页 > 其他好文 > 详细

hra控件自动绑定

时间:2015-07-01 11:51:52      阅读:85      评论:0      收藏:0      [点我收藏+]

标签:

 

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;

 

hra控件自动绑定

标签:

原文地址:http://www.cnblogs.com/kexb/p/4612592.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!