AspNetPager+GridView实现分页的实例代码 |
.框架是.NET Framework 4.0
复制代码 代码如下: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestWebSite.Default" %> <%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %> <!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"> 前台页面程序代码 复制代码 代码如下: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TestWebSite.Utilities; using System.Data; using System.Data.SqlClient; using Wuqi.Webdiyer; namespace TestWebSite ////绑定分页和GridView方法 protected void AspNetPager1_PageChanged(object sender, EventArgs e) CSS样式 复制代码 代码如下: .anpager { font: 11px Arial, Helvetica, sans-serif; padding:10px 20px 10px 0; margin: 0px; } .anpager a { padding: 1px 6px; border: solid 1px #ddd; background: #fff; text-decoration: none; margin-right:2px } .anpager a:visited { padding: 1px 6px; border: solid 1px #ddd; background: #fff; text-decoration: none; } .anpager .cpb { padding: 1px 6px; font-weight: bold; font-size: 13px; border:none } .anpager a:hover { color: #fff; background: #ffa501; border-color:#ffa501; text-decoration: none; } /* AspNetPager1属性设置: CssClass="anpager" CurrentPageButtonClass="cpb"*/ |