我在布局页面里引入了样式和js
@Styles.Render("~/EasyUI/themes/default/easyui.css") @Styles.Render("~/EasyUI/themes/icon.css") @Scripts.Render("~/EasyUI/jquery-1.7.2.min.js") @Scripts.Render("~/EasyUI/jquery.easyui.min.js") @Scripts.Render("~/EasyUI/locale/easyui-lang-zh_CN.js")
控制器里面的方法是:
// // GET: /Admins/ public JsonResult Index() { List list = db.adminList.ToList(); var date = new { total = list.Count, rows = (list) }; return Json(date, JsonRequestBehavior.AllowGet); }
返回给页面的json数据是:
{"total":5,"rows":[{"ID":2,"Account":"aaa","PWD":"111","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null},{"ID":3,"Account":"bbb","PWD":"222","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null},{"ID":4,"Account":"ccc","PWD":"333","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null},{"ID":5,"Account":"ddd","PWD":"444","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null},{"ID":6,"Account":"eee","PWD":"555","Name":null,"Tel":null,"Email":null,"Introduce":null,"Rank":null,"Rights":null,"Created":"\/Date(1373817600000)\/","Enabled":0,"ChannelStr":null,"ColumnStr":null}]}在视图中的用easyui绑定这些数据,居然绑定不出来。
$(function () { $('#list').datagrid({ url: 'Admins/Index',//控制器/方法 columns: [[ { field: 'Account', title: '帐号', width: 100 }, { field: 'PWD', title: '密码', width: 100 }, { field: 'Created', title: '创建时间', width: 100, align: 'right' } ]] }); });
绑定失败了,看到的页面是,上面那一堆json数据,为什么会这样呢?
- 4 回答
- 0 关注
- 374 浏览
添加回答
举报
0/150
提交
取消