首页新闻找找看学习计划

{"MaxJsonLength":2097152,"RecursionLimit":100}问题

0
悬赏园豆:10 [待解决问题]

int index=1;
DataTable dt = BLL.AttendanceInfo.GetAttendanceInfo(index);
List<object> list = new List<object>();
foreach(DataRow dr in dt.Rows)
{
Model.UserInfo u = new Model.UserInfo();
u.UserID = dr["UserID"].ToString();
u.UserName = dr["UserName"].ToString();
Model.DepartmentList d = new Model.DepartmentList();
d.DeptName = dr["DeptName"].ToString();
list.Add(new { UserInfo = u, DepartmentList = d });
}
JavaScriptSerializer js = new JavaScriptSerializer();
string json = js.Serialize(js);
context.Response.Write(json);

灬丶的主页 灬丶 | 初学一级 | 园豆:5
提问于:2016-08-05 13:50
< >
分享
所有回答(4)
0

具体是什么问题呢?

刘宏玺 | 园豆:14004 (专家六级) | 2016-08-05 13:55

alert出来的是这东西,处理程序也没出错。

支持(0) 反对(0) 灬丶 | 园豆:5 (初学一级) | 2016-08-05 13:59

@灬丶: 

int index=1;
DataTable dt = BLL.AttendanceInfo.GetAttendanceInfo(index);
List<object> list = new List<object>();
foreach(DataRow dr in dt.Rows)
{
Model.UserInfo u = new Model.UserInfo();
u.UserID = dr["UserID"].ToString();
u.UserName = dr["UserName"].ToString();
Model.DepartmentList d = new Model.DepartmentList();
d.DeptName = dr["DeptName"].ToString();
list.Add(new { UserInfo = u, DepartmentList = d });
}
JavaScriptSerializer js = new JavaScriptSerializer();
string json = js.Serialize(list);
context.Response.Write(json);

支持(0) 反对(0) 刘宏玺 | 园豆:14004 (专家六级) | 2016-08-05 14:00
0

什么问题?你那list,干嘛非要弄个Object?直接强类型不行?

顾晓北 | 园豆:9530 (大侠五级) | 2016-08-05 14:03
0

string json = js.Serialize(js);

序列化错对象了

胜天半招 | 园豆:686 (小虾三级) | 2016-08-05 14:14
0

这个可以配置的,找一下。但是,已经提示你,你的数据太多已经超长了。

| 园豆:750 (小虾三级) | 2016-08-07 23:33
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册