The Repeater template provided by ASP.NET does not have paging features. If you are a small amount of data, you can use the REPEATER template to implement paging or good, after all, the Repeater template is more flexible.
<%
@ Page language = "c #" codebehind = "Webform1.aspx.cs" autoeventwireup = "false" inherits = "WebApplication1.webform1"
%>
DOCTYPE HTML PUBLIC "- // w3c // DTD HTML 4.0 Transitional // En"
>
<
HTML
>
<
HEAD
>
<
Title
>
Webform1
Title
>
<
Meta
Name
= "Generator"
Content
= "Microsoft Visual Studio .NET 7.1"
>
<
Meta
Name
= "Code_Language"
Content
= "C #"
>
<
Meta
Name
= "VS_DEFAULTCLIENTScript"
Content
= "JavaScript"
>
<
Meta
Name
= "vs_targetschema"
Content
= "http://schemas.microsoft.com/intellisense/ie5"
>
HEAD
>
<
Body
MS_Positioning
= "GridLayout"
>
<
FORM
id
= "Form1"
Method
= "POST"
Runat
= "Server"
>
<
Font
Face
= "Song"
>
<
ASP: REPEATER
id
= "REPEATER1"
Runat
= "Server"
>
<
Headertemplate
>
<
TABLE
Border
= "0"
>
<
TR
>
<
TD
> <
Font
Color
= "Highlight"
>
serial number
Font
>
TD
>
<
TD
> <
Font
Color
= "Highlight"
>
name
Font
>
TD
>
<
TD
> <
Font
Color
= "Highlight"
>
description
Font
>
TD
>
TR
>
Headertemplate
>
<
ItemTemplate
>
<
TR
Bgcolor
= "LIGHTYELLOW"
>
<
TD
>
<%
# DataBinder.eval (Container.DataItem, "CategoryID")%>
TD
>
<
TD
>
<%
# DataBinder.eval (Container.DataItem, "categoryName")
%>
TD
>
<
TD
>
<%
# DataBinder.eval (Container.DataItem, "Description")
%>
TD
>
TR
>
ItemTemplate
>
<
AlternatingItemTemplate
>
<
TR
>
<
TD
>
<%
# DataBinder.eval (Container.DataItem, "categoryid")
%>
TD
>
<
TD
>
<%
# DataBinder.eval (Container.DataItem, "categoryName")
%>
TD
>
<
TD
>
<%
# DataBinder.eval (Container.DataItem, "Description")
%>
TD
>
TR
>
AlternatingItemTemplate
>
<
Footertemplate
>
TABLE
>
<
ASP: ImageButton
CommandName
= "previous"
Id
= "previous"
ImageURL
= "./ images / previous.gif"
Runat
= "Server"
/>
<
ASP: ImageButton
CommandName
= "Next"
Id
= "Next"
ImageURL
= "(iMages / next.gif"
Runat
= "Server"
/>
Footertemplate
>
ASP: REPEATER
>
Font
>
FORM
>
Body
>
HTML
>
Using
System;
Using
System.collections;
Using
System.componentmodel;
Using
System.data;
Using
System.data.sqlclient;
Using
System.drawing;
Using
System.Web;
Using
System.Web.SessionState;
Using
System.Web.ui;
Using
System.Web.ui.WebControls;
Using
System.Web.ui.htmlControls;
Namespace
WebApplication1
{/ ** ////
/// summary> private void InitializeComponent () {this.Repeater1.ItemCommand = new System.Web.UI.WebControls.RepeaterCommandEventHandler (this.Repeater1_ItemCommand); this.Load = new System.EventHandler (this.Page_Load) ;} #endregion private void BindData (int start, int end) {try {con = new SqlConnection (CON_STR);} catch (SqlException sqlexp) {Response.Write ( sqlexp.Message "Connect to database Error!");} DA = New SqldataAdapter (SQL_QUERY, CON); DS = New DataSet (); try {da.fill (DS, START, END, "categories"); this.repeater1.datasource = DS; this.repeater1.database (); } CatCH (Exception Exp) {response.write (exp.Message);} finally {conif. );}}} Private void repeater1_itemCommand (Object sender, system.web.ui.webcontrols.repeatermanCommandEventAndargs e) {if (e.commandname.equals ("next")) {binddata (4, 7);} else if (e. CommandName.Equals ("previous")) {BindData (0, 4);}}}} This page utilizes the DataAdapter's Fill function, but this way is highly efficient, so it only applies to a small amount of data, Large amount of data is significantly reduced.