asp.net学习_分页的设计(12)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:40 点击:次
13: String sortField = context.Request["sortField"];
14: String sortOrder = context.Request["sortOrder"];
15: string strCondition = "";
16: //对搜索内容进行验证
17: if (!Common.Tools.IsValidInput(ref key, false))
18: {
19: return;
20: }
21: else
22: strCondition = masterBLL.ConfirmCondition(key);//判断查询条件
23: masterBLL bll = new masterBLL();
24: //分页数据读取
25: IEnumerable<master> list = bll.ListByPagination(sortField, pageSize, pageIndex + 1, sortOrder == "asc" ? "1" : "0", strCondition);
26: //获取总页数
27: int totalPage = bll.GetCount(strCondition);
28: //JSON 序列化
29: string json = masterBLL.MiniUiListToJson(list, totalPage, "");
30:
31:
32: context.Response.Write(json);
33: }
BLL生成json方法:(这个方法我是代码生成器写成一个模板,然后每次自动生成,免得每次都要写,哈哈哈)
1: /// <summary>
2: /// 专门生成为MiniUi生成json数据(List->json)
3: /// </summary>
4: /// <typeparam name="T">泛型</typeparam>
5: /// <param name="list">实现了Ilist接口的list</param>
6: /// <param name="total">记录总数</param>
7: /// <param name="paramMaxMin">这里放排序的参数例如,string para=""maxAge":37,"avgAge":27,"minAge":24"</param>
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>