SiteMap  | About    

ASP.NET Repeater Paging

The ASP.NET Repeater is a basic container control that allows you to create custom lists from any data available to the page. The Repeater control that render HTML to display the contents of a list or data source to which they are bound. The following ASP.NET program shows how to create a custom pager to the Reapeater control.


In order to build a custom pager, we need two Link button for navigating Next and Previous records and also we need a hidden field to carry the current index of the recordset. Here we are using this index value for retrieving the next group of data from recordset.

  adapter.Fill(dataset, startRecordNo, NoOfRecords, "authors")

The following ASP.NET program retrieves the data from Authors table and display 5 records per page in the Repeater control.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head id="Head1" runat="server">
<title>Untitled Page</title>
	<form id="form1" runat="server">
		<asp:Repeater id="repeater1" runat="server" >
		<%# DataBinder.Eval(Container.DataItem, "au_id")%> &nbsp;&nbsp;
		<%# DataBinder.Eval(Container.DataItem, "au_lname")%> <br />
		<input id="txtHidden" style="width: 28px" type="hidden" value="0"
		runat="server" />
		<asp:LinkButton ID="lnkBtnPrev" runat="server" Font-Underline="False"
		OnClick="lnkBtnPrev_Click" Font-Bold="True"><< Prev </asp:LinkButton>
		<asp:LinkButton ID="lnkBtnNext" runat="server" Font-Underline="False"
		OnClick="lnkBtnNext_Click" Font-Bold="True">Next >></asp:LinkButton>

Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.vb (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.