asp.net mvc 之jqgird 列表数据 根据字典显示中文
colModel: [
{
name: "status", label: "状态", width: 70, align: "left",
formatter: function (cellvalue, options, rowObject) {
if (!!cellvalue) {
var v = cellvalue;
$.ajax({
url: "../../OpticManage/Cable/GetItemName",
data: { ItemId: "50415", keyValue: cellvalue },
async: false,
success: function (data) {
v = data;
}
});
return v;
} else {
return "";
}
}
},
],
Controller层 keyValue 是数据库存储的编号,ItemId是父编号
[HttpGet]
public ActionResult GetItemName(string keyValue, string ItemId)
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("select ItemName from Base_DataItemDetail where ItemId='{0}' and ItemValue={1}", ItemId,keyValue);
string itemname= dbbase.getValue(sb.ToString());
return Content(itemname);
}