asp.net怎么实现分页内容分页显示

周金桥 的BLOG
用户名:周金桥
文章数:240
评论数:863
访问量:2071048
注册日期:
阅读量:5863
阅读量:12276
阅读量:354973
阅读量:1052264
51CTO推荐博文
<font color="#、利用DataGrid内置的分页功能
在DataGrid控件的属性里加入以下语句 AllowPaging="True"PageSize="5"PagerStyle-HorizontalAlign="Right"
注:AllowPaging是指允许分页。 PageSize是指定每页显示的记录数,如果不写,就会默认为10条。PagerStyle-HorizontalAlign是指定分页显示按钮的定位,默认是Left。
<font color="#、利用SQL语句
Select Top @pagesize * from topic where id Not IN (Select Top @pagesize*@pagenum id from topic)
注:@pagesize是指定每页显示的记录数,@pagenum是指第几页。另外topic是表名,id是一个标识列。
<font color="#、利用DataSet.Fill
DataSet ds = new DataSet();SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel,Conn);MyAdapter.Fill(ds,StartIndex,PageSize,"guest");Mydatalist.DataSource = ds.Tables["guest"].DefaultV
注:StartIndex是指读取第几条记录,PageSize是指要读取多少条记录4、利用DataTable.Rows
<font color="#、利用DataTable.Rows
For i = nStart To nEndResponse.Write ( DT.Rows ( i ) ( "ItemName" ) & " &br & " )Next
注:nStart是指开始读取的记录的序号,nEnd是指最后读取的记录的序号DT是一个DataTable对象。
注:nStart是指开始读取的记录的序号,nEnd是指最后读取的记录的序号DT是一个DataTable对象。以上所提到的几种方法都是实现分页功能的核心部份,这些问题解决了,怎样得到数据的总条数、当前页数、分几页等等都容易解决了,与ASP与差别不大。
希望对大家有点帮助。。。。
&本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:┆阅读(0)┆评论(0)jquery 实现分页
jquery 实现分页
采用Jquery无刷新分页插件实现无刷新分页效果
友情提示:本示例Handler中采用StringBuilder的append方法追加HTML,小数据量可以,但是大数据或是布局常变,建议返回JSON格式的数据,性能和灵活性更好!
1.插件参数列表
2.页面内容:
&%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default"%&&!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&Porschev----无刷新翻页&/title&
&script src="Script/jquery-1.4.1.min.js" type="text/javascript"&&/script&
&script src="Script/jquery.pagination.js" type="text/javascript"&&/script&
&script src="Script/tablecloth.js" type="text/javascript"&&/script&
&link href="Style/tablecloth.css" rel="stylesheet" type="text/css"/&
&link href="Style/pagination.css" rel="stylesheet" type="text/css"/&
&script type="text/javascript"&
var pageIndex =0;
//页面索引初始值var pageSize =10;
//每页显示条数初始化,修改显示条数,修改这里即可
$(function() {
InitTable(0);
//Load事件,初始化表格数据,页面索引为0(第一页)
//分页,PageCount是总条目数,这是必选参数,其它参数都是可选
$("#Pagination").pagination(&%=pageCount %&, {
callback: PageCallback,
prev_text: '上一页',
//上一页按钮里text
next_text: '下一页',
//下一页按钮里text
items_per_page: pageSize,
//显示条数
num_display_entries: 6,
//连续分页主体部分分页条目数
current_page: pageIndex,
//当前页索引
num_edge_entries: 2//两侧首尾分页条目数
//翻页调用
function PageCallback(index, jq) {
InitTable(index);
//请求数据
function InitTable(pageIndex) {
type: "POST",
dataType: "text",
url: 'Handler/PagerHandler.ashx',
//提交到一般处理程序请求数据
data: "pageIndex="+ (pageIndex +1) +"&pageSize="+ pageSize,
//提交两个参数:pageIndex(页面索引),pageSize(显示条数)
success: function(data) {
$("#Result tr:gt(0)").remove();
//移除Id为Result的表格里的行,从第二行开始(这里根据页面布局不同页变)
$("#Result").append(data);
//将返回的数据追加到表格
&/script&&/head&&body&&div align="center"&
&h1&Posrchev----无刷新分页&/h1&&/div&&div id="container"&
&table id="Result" cellspacing="0" cellpadding="0"&
&th&编号&/th&
&th&名称&/th&
&div id="Pagination"&&/div&&/div&&/body&&/html&
3.页面.cs文件内容:
using Susing System.Collections.Gusing System.Lusing System.Wusing System.Web.UI;using System.Web.UI.WebCpublic partial class _Default : System.Web.UI.Page {
public string pageCount = string.E //总条目数
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
pageCount = new PagerTestBLL.PersonManager().GetPersonCount().ToString();
4.Handler中的内容:
&%@ WebHandler Language="C#" Class="PagerHandler" %&using Susing System.Wusing System.Collections.Gusing System.Tpublic class PagerHandler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
string str = string.E
//具体的页面数
int.TryParse(context.Request["pageIndex"], out pageIndex);
//页面显示条数
int size = Convert.ToInt32(context.Request["pageSize"]);
if (pageIndex == 0)
pageIndex = 1;
List&PagerTestModels.Person& list = new PagerTestBLL.PersonManager().GetAllPerson(size, pageIndex, "", out count);
StringBuilder sb = new StringBuilder();
foreach (PagerTestModels.Person p in list)
sb.Append("&tr&&td&");
sb.Append(p.Id.ToString());
sb.Append("&/td&&td&");
sb.Append(p.Name);
sb.Append("&/td&&/tr&");
str = sb.ToString();
context.Response.Write(str);
public bool IsReusable {
return false;
5.实现效果图:
6.源码下载地址一:
下载地址二:
示例分页存储过程下载:
发表评论:
TA的最新馆藏&!--前台页面--&&&%@ Page language=&c#& Codebehind=&WebForm1.aspx.cs& AutoEventWireup=&false& Inherits=&Try1.WebForm1& %&&!DOCTYPE HTML PUBLIC &-//W3C//DTD HTML 4.0 Transitional//EN& &&HTML&&&HEAD&& &title&WebForm1&/title&& &meta content=&Microsoft Visual Studio .NET 7.1& name=&GENERATOR&&& &meta content=&C#& name=&CODE_LANGUAGE&&& &meta content=&JavaScript& name=&vs_defaultClientScript&&& &meta content=&/intellisense/ie5& name=&vs_targetSchema&&&&/HEAD&&&body&& &form id=&Form1& method=&post& runat=&server&&&& &P&&FONT face=&宋体&&&/FONT&&&/P&&& &P&&&& &asp:DataGrid id=&DataGrid1& runat=&server& BorderColor=&#3366CC& BorderStyle=&None& BorderWidth=&1px&&&&& BackColor=&White& CellPadding=&4& AllowPaging=&True& PageSize=&5& AllowSorting=&True&&&&&& &SelectedItemStyle Font-Bold=&True& ForeColor=&#CCFF99& BackColor=&#009999&&&/SelectedItemStyle&&&&& &ItemStyle ForeColor=&#003399& BackColor=&White&&&/ItemStyle&&&&& &HeaderStyle Font-Bold=&True& ForeColor=&#CCCCFF& BackColor=&#003399&&&/HeaderStyle&&&&& &FooterStyle ForeColor=&#003399& BackColor=&#99CCCC&&&/FooterStyle&&&&& &PagerStyle HorizontalAlign=&Left& ForeColor=&#003399& BackColor=&#99CCCC& PageButtonCount=&6&&&&&& Mode=&NumericPages&&&/PagerStyle&&&& &/asp:DataGrid&&/P&&& &P&&&& &asp:Panel id=&Panel1& runat=&server&&&&&& &asp:LinkButton id=&btnPrevious& runat=&server& CommandName=&Previous&&&=Previous&/asp:LinkButton&&&&& &FONT face=&宋体&&&&&&&&&&&&&&&&& &asp:LinkButton id=&btnNext& runat=&server& CommandName=&Next&&Next=&&/asp:LinkButton&&&&&& &asp:TextBox id=&txtIndex& runat=&server& Width=&24px& Columns=&2& MaxLength=&2&&&/asp:TextBox&&&&&& &asp:Button id=&btnGo& runat=&server& BackColor=&Gainsboro& BorderWidth=&1px& BorderStyle=&Solid&&&&&&& BorderColor=&Silver& Text=&Go!&&&/asp:Button&&&&&& &asp:Label id=&lblError& runat=&server& ForeColor=&Red& Visible=&False&&No that page!&/asp:Label&&/FONT&&&& &/asp:Panel&&/P&&& &FONT face=&宋体&&&/FONT&&& &asp:Panel id=&pnlIndex& runat=&server&&Panel&/asp:Panel&& &/form&&&/body&&/HTML&//-------后台代码---------------------------------//-------使用的数据库是sqlserver2000示例数据库------using Susing System.CponentMusing System.Cusing System.Dusing System.Dusing System.Wusing System.Web.SessionSusing System.Web.UI;using System.Web.UI.WebCusing System.Web.UI.HtmlCusing System.Data.SqlCnamespace Try1{&/// &summary&&/// WebForm1 的摘要说明。&/// &/summary&&public class WebForm1 : System.Web.UI.Page&{& protected System.Web.UI.WebControls.DataGrid DataGrid1;& private DataSet dsN& protected System.Web.UI.WebControls.Panel Panel1;& protected System.Web.UI.WebControls.LinkButton btnP& protected System.Web.UI.WebControls.LinkButton btnN&& //使用dataview,以实现排序效果& private DataView dvN& protected System.Web.UI.WebControls.TextBox txtI& protected System.Web.UI.WebControls.Button btnGo;& protected System.Web.UI.WebControls.Label lblE& protected System.Web.UI.WebControls.Panel pnlI& && private void Page_Load(object sender, System.EventArgs e)& {&& // 在此处放置用户代码以初始化页面&& LoadDataSet();&& InitpnlIndex();& }& #region Web 窗体设计器生成的代码& override protected void OnInit(EventArgs e)& {&& //&& // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。&& //&& InitializeComponent();&& base.OnInit(e);& }& & /// &summary&& /// 设计器支持所需的方法 - 不要使用代码编辑器修改& /// 此方法的内容。& /// &/summary&& private void InitializeComponent()& {&&& && this.DataGrid1.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGrid1_PageIndexChanged);&& this.DataGrid1.SortCommand += new System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.DataGrid1_SortCommand);&& this.btnPrevious.Click += new System.EventHandler(this.NavigationButtonClick);&& this.btnNext.Click += new System.EventHandler(this.NavigationButtonClick);&& this.btnGo.Click += new System.EventHandler(this.btnGo_Click);&& this.Load += new System.EventHandler(this.Page_Load);& }& #endregion&//加载数据集& private void LoadDataSet()& {&& SqlConnection cnNorth=new SqlConnection(ConfigurationSettings.AppSettings[&cnNorth.ConnectionString&]);&& string cmdString=&SELECT * FROM Customers&;&& SqlDataAdapter adNorth=new SqlDataAdapter(cmdString,cnNorth);&& cnNorth.Open();&& dsNorth=new DataSet();&& try&& {&&& adNorth.Fill(dsNorth,&North&);&& }&& catch&& {&&&&& }&& finally&& {&&& cnNorth.Close();&& }&& dvNorth=new DataView();&& dvNorth.Table=dsNorth.Tables[&North&];&& DataGrid1.DataSource=dvN&& DataGrid1.DataBind();& }&//初始化索引& private void InitpnlIndex()& {&& pnlIndex.Controls.Clear();&& int pageC&& LinkButton btnI&& for (pageCount=0;pageCount&DataGrid1.PageCpageCount++)&& {&&& int btnText=pageCount+1;&&& btnIndex=new LinkButton();&&& btnIndex.Text=btnText.ToString();&&& mandName=pageCount.ToString();&&& btnIndex.Click+=new EventHandler(this.IndexButtonClick);&&& pnlIndex.Controls.Add(btnIndex);&&& pnlIndex.Controls.Add(new LiteralControl(& &));&& }& }&//索引单击效果& private void IndexButtonClick(object sender,System.EventArgs e)& {&& string direction=((LinkButton)sender).CommandN&& int pageIndex=Convert.ToInt32(direction);&& DataGrid1.CurrentPageIndex=pageI&& DataGrid1.DataBind();& }&//排序效果实现& private void DataGrid1_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)& {&& this.dvNorth.Sort=e.SortE&& DataGrid1.DataBind();& }&//索引单击效果& private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)& {&& DataGrid1.CurrentPageIndex=e.NewPageI&& DataGrid1.DataBind();& }&//翻页效果& private void NavigationButtonClick(object sender, System.EventArgs e)& {&& string direction=((LinkButton)sender).CommandN&& switch(direction.ToUpper())&& {&&& case &PREVIOUS&:&&&& DataGrid1.CurrentPageIndex=Math.Max(DataGrid1.CurrentPageIndex-1,0);&&&&&&& case &NEXT&:&&&& DataGrid1.CurrentPageIndex=Math.Min(DataGrid1.CurrentPageIndex+1,DataGrid1.PageCount-1);&&&&&&& default:&&&&&& }&& DataGrid1.DataBind();& & }&//去第几页效果& private void btnGo_Click(object sender, System.EventArgs e)& {&& int pageIndex=0;&& try&& {&&& pageIndex=Convert.ToInt32(txtIndex.Text);&&& && }&& catch(Exception ex)&& {&&& lblError.Visible=&&& lblError.Text=ex.M&& }&& finally&& {&&& lblError.Visible=&&& lblError.Text=&No that page!&;&& }&& if(pageIndex&0&&pageIndex&=DataGrid1.PageCount)&& {&&& try&&& {&&&& DataGrid1.CurrentPageIndex=Math.Min(DataGrid1.PageCount,pageIndex-1);&&&& DataGrid1.DataBind();&&& }&&& catch&&& {&&&& lblError.Visible=&&&& &&& }&&& finally&&& {&&&& lblError.Visible=&&& }&& }&& else&& {&&& lblError.Visible=&& }& }& &}}
??????????asp.net使用listview分页显示数据
&学了这么久的asp.net,越来越发现.net比java简单很多。虽然从程序的实现上C#和java几乎就是相同的,从写程序的时间来看asp.net要比javaweb要快很多,可以这么说使用学习java的方法学习asp.net或者c#是不错的选择。java就没那么多的控件可以给我们使用了。上次我写过一篇怎么使用repeater控件的文章,这次就接着上次的文章来做个listview控件来做个分页显示数据的小程序。
1.准备好一个数据集
2.新建一个aspx页面。打开设计视图,先把objectdatasource控件拖拽进去。配置一下数据源
3.把listview拖拽进来,选择下数据源
4.在listview里手动配置下模板,这里就用表格显示好了
&asp:ListView ID=&ListView1& runat=&server& DataSourceID=&ObjectDataSource1&& ItemContainerID= &ItemPlaceHolder&&&
&&&&&&&&& &LayoutTemplate&&
&&&&&&&&&&& &table border=&1& bordercolor=&#00ff00& width=&500& border-collapse=&&&&
&&&&&&&&&&&&& &thead&&
&&&&&&&&&&&&&&& &tr&&
&&&&&&&&&&&&&&&&& &td&用户名&/td&&
&&&&&&&&&&&&&&&&& &td&密码&/td&&
&&&&&&&&&&&&&&& &/tr&&
&&&&&&&&&&&&& &/thead&&
&&&&&&&&&&&&& &tbody&&
&&&&&&&&&&&&&&& &asp:PlaceHolder runat=&server& ID=&ItemPlaceHolder&&&/asp:PlaceHolder&&
&&&&&&&&&&&&& &/tbody&&
&&&&&&&&&&& &/table&&
&&&&&&&&&&& &asp:DataPager runat=&server& ID=&ContactsDataPager& PageSize=&5&&&
&&&&&&&&&&&&&&& &Fields&&
&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&& &asp:NextPreviousPagerField ShowFirstPageButton=&true& ShowLastPageButton=&true&&
&&&&&&&&&&&&&&&&&& FirstPageText=&首页& LastPageText=&尾页&&
&&&&&&&&&&&&&&&&&& NextPageText=&下一页& PreviousPageText=&上一页&/&&
&&&&&&&&&&&&&&& &/Fields&&
&&&&&&&&&&& &/asp:DataPager&&
&&&&&&&&&&&
&&&&&&&&& &/LayoutTemplate&&
&&&&&&&&& &ItemTemplate&&
&&&&&&&&&&& &tr&&
&&&&&&&&&&&&& &td&&%#Eval(&FNAME&)%&&/td&&
&&&&&&&&&&&&& &td&&%#Eval(&FPASSWORD&)%&&/td&&
&&&&&&&&&&& &/tr&&
&&&&&&&&& &/ItemTemplate&&
&&&&&&&&&&&
&&&&&&& &/asp:ListView&&
&asp:PlaceHolder runat=&server& ID=&ItemPlaceHolder&&&/asp:PlaceHolder&这一句实际上是用来占位的,ID必须和ItemContainerID保持一致,否则会出现下面的错误
5.这里有3种可选的分页,分别是
NextPreviousPagerField,NumericPagerField,TemplatePagerField
几个重要参数如下。
pagesize:每页显示的记录数
ButtonCount:显示的分页数,例如如果有10页,但是ButtonCount=3那么可见的页数就是3页
PreviousPageText:&上一页&的显示文本
NextPageText:&下一页&的显示文本
FirstPageText:&首页&的显示文本
LastPageText:&末页&的显示文本
下面是我写的几种分页模板
&asp:NextPreviousPagerField ShowFirstPageButton=&true& ShowLastPageButton=&true&&
&&&&&&&&&&&&&&&&&& FirstPageText=&首页& LastPageText=&尾页&&
&&&&&&&&&&&&&&&&&& NextPageText=&下一页& PreviousPageText=&上一页&/&&
& &asp:NumericPagerField ButtonCount=&3& PreviousPageText=&上一页& NextPageText=&下一页& /&&
&&asp:TemplatePagerField&&&&&&&&&&&&&&&&
&&&&&&&&&&& &PagerTemplate&&
&&&&&&&&&&& &b&&
&&&&&&&&&&& 第&
&&&&&&&&&&& &asp:Label runat=&server& ID=&CurrentPageLabel&&&
&&&&&&&&&&&&& Text=&&%# Container.TotalRowCount&0 ? (Container.StartRowIndex / Container.PageSize) + 1 : 0 %&& /&&
&&&&&&&&&&& 页&& 共&
&&&&&&&&&&& &asp:Label runat=&server& ID=&TotalPagesLabel&&&
&&&&&&&&&&&&& Text=&&%# Math.Ceiling ((double)Container.TotalRowCount / Container.PageSize) %&& /&页&
&&&&&&&&&& (&
&&&&&&&&&&& 共&asp:Label runat=&server& ID=&TotalItemsLabel&&&
&&&&&&&&&&&&& Text=&&%# Container.TotalRowCount%&& /&&
&&&&&&&&&&& 条记录)&
&&&&&&&&&&& &br /&&
&&&&&&&&&&& &/b&&
&&&&&&&&&&& &/PagerTemplate&&
&&&&&&&&& &/asp:TemplatePagerField&&
&&&&&&&&& &asp:NextPreviousPagerField&
&&&&&&&&&&& ButtonType=&Button&&
&&&&&&&&&&& ShowFirstPageButton=&true&&
&&&&&&&&&&& ShowNextPageButton=&false&&
&&&&&&&&&&& ShowPreviousPageButton=&false& /&&
&&&&&&&&& &asp:NumericPagerField&&
&&&&&&&&&&& PreviousPageText=&& Prev 10&&
&&&&&&&&&&& NextPageText=&Next 10 &&&
&&&&&&&&&&& ButtonCount=&10& /&&
&&&&&&&&& &asp:NextPreviousPagerField&
&&&&&&&&&&& ButtonType=&Button&&
&&&&&&&&&&& ShowLastPageButton=&true&&
&&&&&&&&&&& ShowNextPageButton=&false&&
&&&&&&&&&&& ShowPreviousPageButton=&false& /&&
6.数据显示效果
下面是aspx页面的全部代码
[html] &%@ Page Language=&C#& AutoEventWireup=&true& CodeBehind=&index.aspx.cs& Inherits=&repeater.index& %&&
&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.0 Transitional//EN& &&&&
&html xmlns=&& &&
&head runat=&server&&&
&&& &title&无标题页&/title&&
&&& &style&&
&&&& table&
&&&&&&&& border-collapse:&
&&& &/style&&
&&& &form id=&form1& runat=&server&&&
&&& &asp:ObjectDataSource ID=&ObjectDataSource1& runat=&server&&&
&&&&&&& DeleteMethod=&Delete& InsertMethod=&Insert&&&
&&&&&&& OldValuesParameterFormatString=&original_{0}& SelectMethod=&GetData&&&
&&&&&&& TypeName=&repeater.sources.M_STUDENTDataSetTableAdapters.M_STUDENTTableAdapter&&&
&&&&&&& UpdateMethod=&Update&&&
&&&&&&& &DeleteParameters&&
&&&&&&&&&&& &asp:Parameter Name=&Original_FID& Type=&Int32& /&&
&&&&&&& &/DeleteParameters&&
&&&&&&& &UpdateParameters&&
&&&&&&&&&&& &asp:Parameter Name=&FNAME& Type=&String& /&&
&&&&&&&&&&& &asp:Parameter Name=&FPASSWORD& Type=&String& /&&
&&&&&&&&&&& &asp:Parameter Name=&Original_FID& Type=&Int32& /&&
&&&&&&& &/UpdateParameters&&
&&&&&&& &InsertParameters&&
&&&&&&&&&&& &asp:Parameter Name=&FNAME& Type=&String& /&&
&&&&&&&&&&& &asp:Parameter Name=&FPASSWORD& Type=&String& /&&
&&&&&&& &/InsertParameters&&
&&& &/asp:ObjectDataSource&&
&&& &div&&
&&&&&&& &asp:ListView ID=&ListView1& runat=&server& DataSourceID=&ObjectDataSource1&& ItemContainerID= &ItemPlaceHolder&&&
&&&&&&&&& &LayoutTemplate&&
&&&&&&&&&&& &table border=&1& bordercolor=&#00ff00& width=&500& border-collapse=&&&&
&&&&&&&&&&&&& &thead&&
&&&&&&&&&&&&&&& &tr&&
&&&&&&&&&&&&&&&&& &td&用户名&/td&&
&&&&&&&&&&&&&&&&& &td&密码&/td&&
&&&&&&&&&&&&&&& &/tr&&
&&&&&&&&&&&&& &/thead&&
&&&&&&&&&&&&& &tbody&&
&&&&&&&&&&&&&&& &asp:PlaceHolder runat=&server& ID=&ItemPlaceHolder&&&/asp:PlaceHolder&&
&&&&&&&&&&&&& &/tbody&&
&&&&&&&&&&& &/table&&
&&&&&&&&&&& &asp:DataPager runat=&server& ID=&ContactsDataPager& PageSize=&5&&&
&&&&&&&&&&&&&&& &Fields&&
&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&& &asp:NextPreviousPagerField ShowFirstPageButton=&true& ShowLastPageButton=&true&&
&&&&&&&&&&&&&&&&&& FirstPageText=&首页& LastPageText=&尾页&&
&&&&&&&&&&&&&&&&&& NextPageText=&下一页& PreviousPageText=&上一页&/&&
&&&&&&&&&&&&&&& &/Fields&&
&&&&&&&&&&& &/asp:DataPager&&
&&&&&&&&&&&
&&&&&&&&& &/LayoutTemplate&&
&&&&&&&&& &ItemTemplate&&
&&&&&&&&&&& &tr&&
&&&&&&&&&&&&& &td&&%#Eval(&FNAME&)%&&/td&&
&&&&&&&&&&&&& &td&&%#Eval(&FPASSWORD&)%&&/td&&
&&&&&&&&&&& &/tr&&
&&&&&&&&& &/ItemTemplate&&
&&&&&&&&&&&
&&&&&&& &/asp:ListView&&
&&& &/div&&
&&& &/form&&
&%@ Page Language=&C#& AutoEventWireup=&true& CodeBehind=&index.aspx.cs& Inherits=&repeater.index& %&
&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.0 Transitional//EN& &&&
&html xmlns=&& &
&head runat=&server&&
&&& &title&无标题页&/title&
&&& &style&
&&&& table
&&&&&&&& border-collapse:
&&& &/style&
&&& &form id=&form1& runat=&server&&
&&& &asp:ObjectDataSource ID=&ObjectDataSource1& runat=&server&
&&&&&&& DeleteMethod=&Delete& InsertMethod=&Insert&
&&&&&&& OldValuesParameterFormatString=&original_{0}& SelectMethod=&GetData&
&&&&&&& TypeName=&repeater.sources.M_STUDENTDataSetTableAdapters.M_STUDENTTableAdapter&
&&&&&&& UpdateMethod=&Update&&
&&&&&&& &DeleteParameters&
&&&&&&&&&&& &asp:Parameter Name=&Original_FID& Type=&Int32& /&
&&&&&&& &/DeleteParameters&
&&&&&&& &UpdateParameters&
&&&&&&&&&&& &asp:Parameter Name=&FNAME& Type=&String& /&
&&&&&&&&&&& &asp:Parameter Name=&FPASSWORD& Type=&String& /&
&&&&&&&&&&& &asp:Parameter Name=&Original_FID& Type=&Int32& /&
&&&&&&& &/UpdateParameters&
&&&&&&& &InsertParameters&
&&&&&&&&&&& &asp:Parameter Name=&FNAME& Type=&String& /&
&&&&&&&&&&& &asp:Parameter Name=&FPASSWORD& Type=&String& /&
&&&&&&& &/InsertParameters&
&&& &/asp:ObjectDataSource&
&&&&&&& &asp:ListView ID=&ListView1& runat=&server& DataSourceID=&ObjectDataSource1&& ItemContainerID= &ItemPlaceHolder&&
&&&&&&&&& &LayoutTemplate&
&&&&&&&&&&& &table border=&1& bordercolor=&#00ff00& width=&500& border-collapse=&&&
&&&&&&&&&&&&& &thead&
&&&&&&&&&&&&&&& &tr&
&&&&&&&&&&&&&&&&& &td&用户名&/td&
&&&&&&&&&&&&&&&&& &td&密码&/td&
&&&&&&&&&&&&&&& &/tr&
&&&&&&&&&&&&& &/thead&
&&&&&&&&&&&&& &tbody&
&&&&&&&&&&&&&&& &asp:PlaceHolder runat=&server& ID=&ItemPlaceHolder&&&/asp:PlaceHolder&
&&&&&&&&&&&&& &/tbody&
&&&&&&&&&&& &/table&
&&&&&&&&&&& &asp:DataPager runat=&server& ID=&ContactsDataPager& PageSize=&5&&
&&&&&&&&&&&&&&& &Fields&
&&&&&&&&&&&&&&
&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&& &asp:NextPreviousPagerField ShowFirstPageButton=&true& ShowLastPageButton=&true&
&&&&&&&&&&&&&&&&&& FirstPageText=&首页& LastPageText=&尾页&
&&&&&&&&&&&&&&&&&& NextPageText=&下一页& PreviousPageText=&上一页&/&
&&&&&&&&&&&&&&& &/Fields&
&&&&&&&&&&& &/asp:DataPager&
&&&&&&&&& &/LayoutTemplate&
&&&&&&&&& &ItemTemplate&
&&&&&&&&&&& &tr&
&&&&&&&&&&&&& &td&&%#Eval(&FNAME&)%&&/td&
&&&&&&&&&&&&& &td&&%#Eval(&FPASSWORD&)%&&/td&
&&&&&&&&&&& &/tr&
&&&&&&&&& &/ItemTemplate&
&&&&&&& &/asp:ListView&
&&& &/div&
&&& &/form&
代码我上传到资源里大家自己下载吧,有问题可以写评论给我
摘自 Nothing is impossible
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'

我要回帖

更多关于 html怎么实现分页显示 的文章

 

随机推荐