jQuery EasyUI DataGrid 分页 FOR ASP.NET
源代码:
前台(html):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>邮件列表</title><link rel="stylesheet" type="text/css" href="../jQuery/themes/default/easyui.css" /><link rel="stylesheet" type="text/css" href="../jQuery/themes/icon.css" /><script type="text/javascript" src="../jQuery/jquery-1.7.1.min.js"></script><script type="text/javascript" src="../jQuery/jquery.easyui.min.js"></script><script type="text/javascript" language="javascript">$(function(){$('#ReceiveList').datagrid({title:'收件箱',loadMsg:"正在加载,请稍等...", striped: true,fit: true,//自动大小 fitColumns: true,url:'../Common/DealData.ashx?Menu=Mail&MailFolder=Receive',//查看收件箱内容 columns:[[{field:'MailID',checkbox:true},{field:'MailSender',title:'发件人',width:120,sortable:true,searchtype:"number"},{field:'MailSendDate',title:'发件时间',width:120,sortable:true},{field:'MailSubject',title:'标题',width:200,sortable:true]], rownumbers:true,//行号 singleSelect:false,//是否单选 pagination:true//分页控件 });//设置分页控件 var p = $('#ReceiveList').datagrid('getPager'); $(p).pagination({ pageSize: 10,//每页显示的记录条数,默认为10 pageList: [10,20,50],//可以设置每页记录条数的列表 beforePageText: '第',//页数文本框前显示的汉字 afterPageText: '页 共 {pages} 页', displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录' });});</script> </head> <body class="easyui-layout"><div region="center" title="列表" style="overflow:hidden;"><div id="main" class="easyui-tabs" fit="true" border="false"><div title="首页" style="padding:20px;overflow:hidden;"> <div style="margin-top:20px;">首页</div></div><div title="收件箱" closable="true" selected="true" style="overflow:hidden;"><table id="ReceiveList"></table> </div></div></div> </body> </html>
后台(DealData.ashx):
using System; using System.Collections; using System.Data; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Collections.Generic;namespace YM.Web.Common {/// <summary>/// $codebehindclassname$ 的摘要说明/// </summary>[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]public class DealData : IHttpHandler{public void ProcessRequest(HttpContext context){context.Response.ContentType = "text/plain";//获取邮件信息,返回Json数据string strMailFolder = context.Request["MailFolder"];//rows和page是jQuery默认传的值(暂时还不知道怎么传的)int intPageSize = int.Parse(context.Request["rows"].ToString());int intCurrentPage = int.Parse(context.Request["page"].ToString());//分页属性YM.Model.PaginationCondition Pcondition = new YM.Model.PaginationCondition(intCurrentPage, intPageSize);string strJson = GetMailToJson(strMailFolder, Pcondition);context.Response.Write(strJson);}public bool IsReusable{get{return false;}}#region 获取邮件信息/// <summary>/// 获取邮件信息/// </summary>/// <param name="strMailFolder">邮件类型</param>/// <param name="Pcondition">分页属性</param>/// <returns>返回Json字符串</returns>public string GetMailToJson(string strMailFolder, YM.Model.PaginationCondition Pcondition){string strResult = string.Empty;switch (strMailFolder){case "Receive"://收件箱YM.BLL.MailBLL mailBLL = new YM.BLL.MailBLL();YM.Model.Pagination<YM.Model.Mail> mailResult = mailBLL.GetList(Pcondition, "");//将List转换为Json(这里要传“rows”,因为Jquery里面只认rows)strResult = YM.Common.ConvertJson.ListToJson(mailResult.Results, mailResult.TotalCount, "rows");break;default:break;}return strResult;}#endregion} }
jQuery EasyUI DataGrid 分页 FOR ASP.NET相关推荐
- jquery easyui datagrid 分页 详解
http://www.cnblogs.com/huozhicheng/archive/2011/09/27/2193605.html 由于项目原因,用了jquery easyui 感觉界面不错,皮肤样 ...
- jQuery EasyUI datagrid实现本地分页的方法
本文实例讲述了jQuery EasyUI datagrid实现本地分页的方法.分享给大家供大家参考.具体如下: 一般分页都是后台做,前端做无论从哪方面考虑都不合适.但是有的时候还是有这种需求. 这里重 ...
- jQuery EasyUI DataGrid Checkbox 数据设定与取值
纯粹做个记录,以免日后忘记该怎么设定. 这一篇将会说明两种使用 jQuery EasyUI DataGrid 的 Checkbox 设定方式,以及在既有数据下将 checked 为 true 的该笔数 ...
- easyui php分页,easyui datagrid分页 4、easyUI-七种布局(layout)
1.为网页创建边框布局 边框布局(border layout)提供五个区域:east.west.north.south.center.以下是一些通常用法: north 区域可以用来显示网站的标语. s ...
- 使用easyUI datagrid分页
使用easyUI datagrid分页 我用了比较简单的sturts2和mybatis结合的小测试demo实现的. 一.使用easyUI datagrid分页注意事项及原理: 1.EasyUI的Dat ...
- jquery easyui dataGrid动态改变排序字段名
2019独角兽企业重金招聘Python工程师标准>>> jquery easyui dataGrid 动态改变排序字段名,一般情况下,在使用的时候,我们会点击相应字段进行排序, 这里 ...
- jQuery EasyUI datagrid本地分页
2019独角兽企业重金招聘Python工程师标准>>> 代码如下: <!DOCTYPE html> <html> <head> <meta ...
- Jquery Easyui Datagrid创建代码
引用easyui <link rel="stylesheet" type="text/css" href="../themes/default/ ...
- 让jquery easyui datagrid列支持绑定嵌套对象
嵌套对象是指返回的json数据,是对象的某个属性自带有属性.而我们恰恰又需要这个属性,默认情况下easyui的datagrid是不支持绑定嵌套对象的.比如:datagrid的field属性只能为fie ...
最新文章
- AI加持的WPS来了:金山开源全球首个办公DL框架KSAI-Lite
- [ATF]-MTK:一篇文章了解ATF原理
- 批量设置Service Order成transferred状态
- 文字转语音+html5,JS实现文字转语音并播放
- iOS开发tableview二级联动的细节实现中注意的细节总结
- 阿里巴巴对Java编程【控制语句】的规约
- mybatis报错Type interface xxx.Dao is not known to the MapperRegistry
- mysql自增id用完了_MySQL表自增id用完了该怎么办?
- javascript 函数式编程(1)
- 题目47:最大公约数
- 计算机三级网络技术备考复习资料
- 卡方检验结果表格中出现非常多个卡方值和P值的原理和实现步骤
- 《系统论、信心论、控制论》读书笔记1
- 区块链 Fisco bcos 智能合约(22)-全面的性能分析工具
- 记录~OPENCV读图失败的三种情况,其中一种情况罕见
- ant+jmeter接口测试
- HTML Tab 选项卡
- py语法07-字符串的操作
- 前缀表达式与后缀表达式求法(栈的应用)
- 2018年CSDN博客排名第一名,花落谁家?
热门文章
- 厉害!冬奥首金选手都来自这所高校!还全是研究生!
- CV十年发展之观察:1.5万篇论文透视「业界」与「学界」,到底谁更胜一筹?...
- 人工智能专业太卷,发不出好文章?看看顶刊审稿人怎么说...
- 华为正式发布鸿蒙2.0,更新人数太多挤爆服务器,P50也官宣了!
- 深度学习debug沉思录
- YOLOv4 论文翻译
- Python 四大基本语法
- Linux用户必须知道的常用终端快捷键
- 【学术前沿】26 亿参数量,水平接近人类,Google 的开放领域聊天机器人意义何在?...
- python从控制台读取数据