1、效果预览



2、HTML代码

 <div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12 col-xxs-12">
<table class="table table-striped table-hover table-bordered bootstrap-datatable " id="TemplateTable">
<thead>
<tr>
<td>模板名称</td>
<td style="width: 400px;">短信内容</td>
<td>操作</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="row" style="margin-top: 15px;">
<div class="col-lg-12 col-sm-12 col-xs-12 col-xxs-12">
<div style="font-size: 14px;">共<label style="color: #20A8D8; font-size: 14px;" id="pageCount">0</label>条记录</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12 col-xxs-12">
<div id="MainContent_AspNetPager_Msg" class="paginator">
<a style="margin-right: 5px; cursor: pointer;" href="javascript:void(0)" onclick="PageIndexClick(this)" id="FirstPage" pageindex="1">首 页 </a>
<a style="margin-right: 5px; cursor: pointer;" href="javascript:void(0)" onclick="PageIndexClick(this)" id="TopPage" pageindex="0">← 上一页</a>
<span class="cpb" style="margin-right: 5px; cursor: pointer;" id="CurrenPageSize">1</span>
<a style="margin-right: 5px; cursor: pointer;" href="javascript:void(0)" onclick="PageIndexClick(this)" id="NextPage" pageindex="0">→ 下一页</a>
<a style="margin-right: 5px; cursor: pointer;" href="javascript:void(0)" onclick="PageIndexClick(this)" id="LastPage" pageindex="0"> 尾 页 </a>
</div>
</div>
</div>

3、JS代码

//载入短信模板内容-分页
function TemplateAjax() {
$('#TemplateTable tbody tr').remove();//清空Table tbody
AjaxPage(1, PageSize);
} //当前页,显示条数
function AjaxPage(curpage, PageSize) {
//省
var ProvinceId = $('#MainContent_ddlsheng').val();
//市
var CityId = $('#MainContent_ddlshi').val();
$.ajax({
cache: false,
url: "/ajaxpage/getajax.aspx?t=smsplateformtemplateajaxpage&ProvinceId=" + ProvinceId + "&CityId=" + CityId + "&CurPage=" + curpage + "&PageSize=" + PageSize + "&a=" + Math.random(),
dataType: 'json',
success: function (data) {
if (data != null) {
var str = '';
for (var i in data["Data"]) {
var Content = data["Data"][i]["SmsTemplateContent"];
if (Content.length >= 60) {
Content = Content.substring(0, 60);
}
str += "<tr><td>" + data["Data"][i]["SmsTemplateName"] + "</td><td>" + Content + "</td><td><input type='button' value=' 删 除 ' class='btn btn-primary' onclick='TemplateDelete(" + data["Data"][i]["Id"] + ")'/></td></tr>";
}
$('#TemplateTable tbody').html(str);
RecordCount = data["RecordCount"];
$('#pageCount').html(RecordCount); }
}
})
}
//首页、上一页、下一页、尾页点击
function PageIndexClick(obj) {
//当前第几页
var CurrenPageSize = $('#CurrenPageSize').html();
//id
var type = $(obj).attr('id');
//首页
if (type == 'FirstPage') {
CurrenPageSize = 1;
AjaxPage(CurrenPageSize, PageSize);
$('#CurrenPageSize').html('1');
}
//上一页
else if (type == 'TopPage') {
if (CurrenPageSize > 1) {
CurrenPageSize = parseInt(CurrenPageSize) - 1;
} else {
CurrenPageSize = 1;
}
AjaxPage(CurrenPageSize, PageSize);
$('#CurrenPageSize').html(CurrenPageSize);
}
//下一页
else if (type == 'NextPage') {
var size = parseInt(CurrenPageSize) + 1;
var maxpage = RecordCount % PageSize == 0 ? parseInt(RecordCount / PageSize) : (parseInt(RecordCount / PageSize) + 1);
if (size <= maxpage) {
CurrenPageSize = parseInt(CurrenPageSize) + 1
}
AjaxPage(CurrenPageSize, PageSize);
$('#CurrenPageSize').html(CurrenPageSize);
}
//尾页
else if (type == 'LastPage') {
CurrenPageSize = (RecordCount % PageSize == 0 ? parseInt(RecordCount / PageSize) : parseInt(RecordCount / PageSize) + 1);
AjaxPage(CurrenPageSize, PageSize);
$('#CurrenPageSize').html(CurrenPageSize);
}
} //删除模板
function TemplateDelete(id) {
$.ajax({
cache: false,
url: "/ajaxpage/getajax.aspx?t=smsplateformtemplateajaxdelete&Id=" + id + "&a=" + Math.random(),
dataType: 'json',
success: function (data) {
if (data != null) {
alert(data['result']);
AjaxPage(1, PageSize);
}
}
});
}

4、C#后台代码

           if(Request.QueryString["t"] == "smsplateformtemplateajaxpage")
{
try
{
string ProvinceId = Request.QueryString["ProvinceId"];
string CityId = Request.QueryString["CityId"];
int CurPage = 1;//当前第几页
int.TryParse(Request.QueryString["CurPage"], out CurPage);
int PageSize = 5;//每页显示多少条数据
int.TryParse(Request.QueryString["PageSize"], out PageSize); StringBuilder sb = new StringBuilder();
sb.Append(" 1=1 and (delete_flag IS NULL OR delete_flag=0)");
//省
if (ProvinceId != null && !string.IsNullOrEmpty(ProvinceId) && ProvinceId != "0")
{
sb.Append(string.Format(" and ProvinceId={0} ", ProvinceId.Trim()));
}
//市
if (!string.IsNullOrEmpty(CityId) && CityId != "0" && CityId != "null")
{
sb.Append(string.Format(" and CityId={0} ", CityId.Trim()));
}
PageArgs pageArgs = new PageArgs();
pageArgs.PageSize = PageSize;
pageArgs.PageIndex = CurPage;
pageArgs.TableName = "D_SMSTemplate";
pageArgs.PrimaryKey = "Id";
pageArgs.Fields = "";
pageArgs.Filter = sb.ToString();
pageArgs.Order = " create_time desc";
IList<SMSTemplateEntity> list = new SMSTemplateBLL().GetSMSTemplateAll(ref pageArgs); List<Dictionary<string, object>> li = new List<Dictionary<string, object>>();
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("RecordCount", pageArgs.RecordCount);//总条数
dic.Add("Data", list); JavaScriptSerializer serializer = new JavaScriptSerializer();
var result = serializer.Serialize(dic);
Response.Write(result);
}
catch
{
Response.Write(null);
}
}






******************************************别墅图纸推荐*************************************************




我想有一栋别墅。面朝大海,春暖花开

龙兴科技别墅图纸设计,这里有最新最全的别墅图纸,

这里有最给力的别墅图纸折扣活动。图纸包含建筑图、结构图、给排水图、电气图

我们致力于为广大客户提供别墅设计图纸,图纸均由专业、经验丰富的设计团队设计,可免费提供施工技术指导


版权声明:本文博客原创文章,博客,未经同意,不得转载。

jQuery、Ajax分页的更多相关文章

  1. 转:精心挑选的12款优秀 jQuery Ajax 分页插件和教程

    在这篇文章中,我为大家收集了12个基于 jQuery 框架的 Ajax 分页插件,这些插件都提供了详细的使用教程和演示.Ajax 技术的出现使得 Web 项目的用户体验有了极大的提高,如今借助优秀的  ...

  2. 分享一个手机端好用的jquery ajax分页类

    分享一个手机端好用的jquery ajax分页类 jquery-ias.min.js 1,引入jquery-ias.min.js 2,调用ajax分页 <script type="te ...

  3. 12款优秀 jQuery Ajax 分页插件和教程

    12款优秀 jQuery Ajax 分页插件和教程 在这篇文章中,我为大家收集了12个基于 jQuery 框架的 Ajax 分页插件,这些插件都提供了详细的使用教程和演示.Ajax 技术的出现使得 W ...

  4. jquery ajax分页写法

    jquery ajax分页写法我用的是laypage插件 前端代码<pre> function demo(curr) { $.getJSON('/home/index/getinfo', ...

  5. 精心挑选的12款优秀 jQuery Ajax 分页插件和教程

    在这篇文章中,我为大家收集了12个基于 jQuery 框架的 Ajax 分页插件,这些插件都提供了详细的使用教程和演示.Ajax 技术的出现使得 Web 项目的用户体验有了极大的提高,如今借助优秀的  ...

  6. Pagination jquery ajax 分页参考资料

    http://www.zhangxinxu.com/wordpress/2010/01/jquery-pagination-ajax%E5%88%86%E9%A1%B5%E6%8F%92%E4%BB% ...

  7. 12款优秀jQuery Ajax分页插件和教程

    在这篇文章中,我为大家收集了12个基于 jQuery 框架的 Ajax 分页插件,这些插件都提供了详细的使用教程和演示.Ajax 技术的出现使得 Web 项目的用户体验有了极大的提高,如今借助优秀的 ...

  8. jquery+ajax分页

    先看效果图:

  9. jquery ajax 分页2

    /* * 分页 $("#divPager").flexipager * 2015.03.17 */ //初始化列表默认属性 (function($) { $.addFlex = f ...

  10. jquery ajax 分页

    <script src="../Js/jQuery/jquery-1.8.2.min.js" type="text/javascript">< ...

随机推荐

  1. 从零開始学习OpenCL开发(一)架构

    多谢大家关注 转载本文请注明:http://blog.csdn.net/leonwei/article/details/8880012 本文将作为我<从零開始做OpenCL开发>系列文章的 ...

  2. .Net程序猿玩转Android开发---(7)相对布局RelativeLayout

                 相对布局RelativeLayout是Android布局中一个比較经常使用的控件,使用该控件能够布局出适合各种屏幕分辨率的布局,RelativeLayout採用相对位置进行 ...

  3. 如何检测被锁住的Oracle存储过程及处理办法汇总(转)

    1.查看是哪一个存储过程被锁住查V$DB_OBJECT_CACHE视图select * from V$DB_OBJECT_CACHE where owner='过程的所属用户' AND LOCKS!= ...

  4. Quasi-Newton Method--LBFGS

    Quasi-Newton Method Quasi-Newton Method每一步计算过程中仅涉及到函数值和函数梯度值计算,这样有效避免了Newton Method中涉及到的Hessian矩阵计算问 ...

  5. OGG-01008 Extract displays Discarding bad record (discard recs=1) when using filter or where clause

    因为在extract參数文件里使用了where语句,而where后面的的条件列又不是主键,没有为update.delete操作记录日志,因此会报1008错误. Applies to: Oracle G ...

  6. Js常用技巧

    摘录:http://crasywind.blog.163.com/blog/static/7820316920091011643149/ js 常用技巧 1. on contextmenu=" ...

  7. bootstrap的popover在trigger设置为hover时不隐藏popover

    使用bootstrap的popover,trigger设置为hover时,可以实现当鼠标放置到目标元素上时显示popover,可是无法实现当鼠标移动到popover上时不隐藏popover,在网上找了 ...

  8. 利用ffmpeg将H264解码为RGB

    因为公司买到了一个不提供解码器的设备,我不得已还要做解码的工作.在网上找了一圈,H264解码比較方便的也就是ffmpeg一系列的函数库了,原本设备中也是用这套函数库解码,但厂家不给提供,没办法,仅仅得 ...

  9. 解决mongodb设备mongod命令不是内部或外部的命令

    1:安装 去mongodb的官网http://www.mongodb.org/downloads下载32bit的包 解压后会出现下面文件 在安装的盘C:下建立mongodb目录,拷贝bin目录到该目录 ...

  10. 制作service服务,shell脚本小例子(来自网络)

    事先准备工作:源码安装apache .安装目录为/usr/local/httpd 任务需求:1.可通过 service httpd start|stop|status|restart 命令对服务进行控 ...