java ajax分页,三层架构+ajax分页实例,ASP.NET存储过程实现分页效果(三层架构)

 2023-09-23 阅读 17 评论 0

摘要:本文实例为大家分享了ASP.NET存储过程实现分页的具体代码,供大家参考,具体内容如下实现效果:文本框内输入跳转的页数,点击GO会跳转到该页java ajax分页、首先在项目下加入BLL,DAL,DataAccess,MODEL类库1、前台界面$(function () {$('#txtPage

本文实例为大家分享了ASP.NET存储过程实现分页的具体代码,供大家参考,具体内容如下

实现效果:

文本框内输入跳转的页数,点击GO会跳转到该页

8bc3145d24b612620fc046981117b848.png

java ajax分页、首先在项目下加入BLL,DAL,DataAccess,MODEL类库

1、前台界面

$(function () {

$('#txtPageindex').focus(function () {

存储过程实现分页、$(this).val("");

})

})

分页查询sql,DataFormatString="{0:yyyy-MM-dd hh:mm:ss}" HeaderText="创建时间" />

第一页

ID="btnPre" runat="server" οnclick="btnPre_Click">上一页

django 分页,

runat="server" οnclick="btnNext_Click">下一页

最后一页

ID="txtPageindex" runat="server">

jquery datatable 分页,Go

2、后台代码

using System;

using System.Collections.Generic;

分页查询怎么实现、using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

分页java、using System.Data;

namespace 分页

{

public partial class 原始刷新分页 : System.Web.UI.Page

java三种分页实现。{

int pagesize = 10;

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

ViewState["pageindex"] = 1;

GetLastPageindex();

LoadData();

}

}

private void GetLastPageindex()

{

BLL.T_News1 bnews = new BLL.T_News1();

int totalcount = bnews.GetRecordCount("");

if (totalcount % pagesize == 0)

{

ViewState["lastpageindex"] = totalcount / pagesize;

}

else { ViewState["lastpageindex"] = totalcount / pagesize+1; }

}

private void LoadData()

{

BLL.T_News1 bnews = new BLL.T_News1();

DataTable dt = bnews.GetListDataTable(pagesize,Convert.ToInt32(ViewState["pageindex"]));

this.GridView1.DataSource = dt;

this.GridView1.DataBind();

}

protected void btnFirst_Click(object sender, EventArgs e)

{

ViewState["pageindex"] = 1;

LoadData();

}

protected void btnPre_Click(object sender, EventArgs e)

{

int pageindex = Convert.ToInt32(ViewState["pageindex"]);

if (pageindex > 1)

{

pageindex--;

ViewState["pageindex"] = pageindex;

LoadData();

}

}

protected void btnNext_Click(object sender, EventArgs e)

{

int pageindex = Convert.ToInt32(ViewState["pageindex"]);

if (pageindex < Convert.ToInt32(ViewState["lastpageindex"]))

{

pageindex++;

ViewState["pageindex"] = pageindex;

LoadData();

}

}

protected void btnLast_Click(object sender, EventArgs e)

{

ViewState["pageindex"] = ViewState["lastpageindex"];

LoadData();

}

protected void LinkButton5_Click(object sender, EventArgs e)

{

int result;

if (int.TryParse(txtPageindex.Text, out result) == true)

{

ViewState["pageindex"] = txtPageindex.Text.Trim();

LoadData();

}

else { txtPageindex.Text = "请输入合法的数字"; }

}

}

}

3、数据库存储过程

declare @pagesize int;

declare @pageindex int;

SELECT * FROM (select ROW_NUMBER() over(order by Id) as rownumber,* from T_News1)T

WHERE rownumber>(@pageindex-1)*@pagesize AND rownumber<=@pagesize*@pageindex

GO

CREATE PROC pro_fenye

@pagesize int,

@pageindex int

as

select * from(select ROW_NUMBER() over(order by Id) as rownumber,* from T_News1)T

WHERE rownumber>(@pageindex-1)*@pagesize AND rownumber<=@pageindex*@pagesize

GO

exec pro_fenye 2,5

以上就是本文的全部内容,希望对大家的学习有所帮助。

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/89362.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息