前台:
$(function () {
$('#dg').datagrid({
url: 'CustomerArea/CustomerPage/ActivitysPage',
method: 'GET', //默认是post,不允许对静态文件访问
dataType: 'JSON',
fitColumns: true,
columns: [[
{
field: 'ActDate', title: '时间', width: 100,
formatter: function (value, row, index) {
try {
var date = new Date(parseInt(/\d+/.exec(value)[0]));
var year = parseInt(date.getFullYear());
if (year > 2500 || year < 1900)
{ return ""; }
return date.getFullYear() + "年" + (date.getMonth() + 1) + "月" + date.getDate() + "日";
} catch (e) {
return "";
}
}
},
{ field: 'ActAdd', title: '地点', width: 100 },
{ field: 'ActTitle', title: '概要', width: 100 },
{ field: 'ActDesc', title: '详细信息', width: 100 },
{ field: 'ActID', title: '操作', width: 100,
formatter: function (value, row, index) {
return '<a href="ActivitysEdit.htm?"><img title="编辑" src="/images/33.gif"style="border:0px" /></a> <img title="删除" src="/images/11.gif" />'
}
}
]],
singleSelect: true//不允许选择多行
});
})
后台:
public ActionResult ActivitysPage()
{
ActivitysBLL ABLL = new ActivitysBLL();
List<Activitys> list = ABLL.GetAllInfo();
return Json(list, JsonRequestBehavior.AllowGet);
}
实体类:
public class Activitys: ModelBase
{
public System.Int32? ActID{get;set;}
public System.String CusID{get;set;}
public System.String CusName{get;set;}
public System.DateTime? ActDate{get;set;}
public System.String ActAdd{get;set;}
public System.String ActTitle{get;set;}
public System.String ActDesc{get;set;}
}
不知道为什么显示的页面是这样的