The. aspx code is as follows:
<%@ page language= "C #" autoeventwireup= "true" codefile= "Sample3_DataPager.aspx.cs" inherits= "Sample_03_datapager "%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title></title>
<style type = "Text/css" >
Div.divpager {padding:10px; Background-color: #363636;}
/* Common styles for all buttons: Active button, inactive button, page number, current page number */
. Divpager A,. Divpager span span
{display:block; float:left;
padding:5px 8px 5px 8px; margin-left:4px;
font-size:14px;
Color: #ddd;
Background-color: #630;
border:1px solid #d88;
Text-decoration:none; }
/* Mouse in style (active button, page number) */
. Divpager a:hover
{color:white; Background-color: #a30;}
/* Current page number */
. Divpager Span.pagenow
{background-color: #a30; color:white;
Font-weight:bold; border:1px solid #ddd;
}
/* Inactive button */
. Divpager span Span
{border:1px solid gray; color: #999;}
</style>
<body>
<form id= "Form1" runat= "Server" >
<div>
<asp:listview id= "ListView1" runat= "Server" datasourceid= "AccessDataSource1"
Itemplaceholderid= "Itemholder"
>
<LayoutTemplate>
<div runat= "Server" id= "Itemholder" ></div>
</LayoutTemplate>
<ItemTemplate>
<div style= "PADDING:5PX; border:1px solid silver; ><% #Eval ("Mo_name")%></div>
</ItemTemplate>
</asp:ListView>
<asp:datapager id= "DataPager1" runat= "Server" pagedcontrolid= "ListView1"
Pagesize= "1" >
<Fields>
<asp:nextpreviouspagerfield buttontype= "link"
Showfirstpagebutton= "true"
Shownextpagebutton= "false"
renderdisabledbuttonsaslabels = "true"/>
<asp:numericpagerfield currentpagelabelcssclass= "Pagenow"
Buttontype= "link" buttoncount= "6"
nextpagetext= ">>" previouspagetext= "<<"/>
<asp:nextpreviouspagerfield buttontype= "link"
Showpreviouspagebutton= "false" showlastpagebutton= "true"
renderdisabledbuttonsaslabels = "true"/>
</Fields>
</asp:DataPager>
<div class = "Divpager" >
<asp:datapager id= "DataPager2" runat= "Server" pagedcontrolid= "ListView1"
Pagesize= "1" >
<Fields>
<asp:nextpreviouspagerfield buttontype= "link"
Showfirstpagebutton= "true"
Shownextpagebutton= "false"
renderdisabledbuttonsaslabels = "true"/>
<asp:numericpagerfieldcurrentpagelabelcssclass= "Pagenow"
Buttontype= "link" buttoncount= "6"
nextpagetext= ">>" previouspagetext= "<<"/>
<asp:nextpreviouspagerfield buttontype= "link"
Showpreviouspagebutton= "false" showlastpagebutton= "true"
renderdisabledbuttonsaslabels = "true"/>
</Fields>
</asp:DataPager>
<div style = "clear:both;" ></div>
</div>
<asp:accessdatasource id= "AccessDataSource1" runat= "Server"
Datafile= "~/mdb/ev.mdb" selectcommand= "select * from [Tb_monitor]" >
</asp:AccessDataSource>
</div>
</form>
</body>
The effect is as follows:
ASP. NET paging control CSS