自定义设置格式化代码: <webdiyer:AspNetPager id="AspNetPagerView" runat="server" SubmitButtonText="转到" ShowPageIndex="False" ShowInputBox="Always" LastPageText="<font style='FONT-SIZE: x-small'>最后页</fornt>" NextPageText="<font style='FONT-SIZE: x-small'>下一页</fornt>" PrevPageText="<font style='FONT-SIZE: x-small'>前一页</fornt>" FirstPageText="<font style='FONT-SIZE: x-small'>最前页</fornt>" InputBoxStyle="border:1px #0000FF solid;text-align:center;FONT-SIZE: x-small" TextBeforeInputBox="第" TextAfterInputBox="页" ShowCustomInfoSection="Right" AlwaysShow="True" CustomInfoTextAlign="Center" SubmitButtonStyle="width:40px;height:21px;"></webdiyer:AspNetPager>后台使用代码: private void Page_Load(object sender, System.EventArgs e) ...{ if(!Page.IsPostBack) ...{ this.sqlCmd=new System.Data.SqlClient.SqlCommand("SP_AspNetPager_Meeting",this.sqlConn); this.sqlCmd.CommandType=CommandType.StoredProcedure; this.sqlCmd.Parameters.Add("@pageindex",1); this.sqlCmd.Parameters.Add("@pagesize",1); this.sqlCmd.Parameters.Add("@docount",true); this.sqlConn.Open(); this.AspNetPagerView.RecordCount=(int)this.sqlCmd.ExecuteScalar(); this.sqlConn.Close(); this.SetBindData(); } } private void SetBindData() ...{ this.sqlCmd=new SqlCommand("SP_AspNetPager_Meeting",this.sqlConn); this.sqlCmd.CommandType=CommandType.StoredProcedure; this.sqlCmd.Parameters.Add("@pageindex",this.AspNetPagerView.CurrentPageIndex); this.sqlCmd.Parameters.Add("@pagesize",this.AspNetPagerView.PageSize); this.sqlCmd.Parameters.Add("@docount",false); this.sqlConn.Open(); this.dg.DataSource=this.sqlCmd.ExecuteReader(); this.dg.DataBind(); this.sqlConn.Close(); this.AspNetPagerView.CustomInfoText=" 当前页:<font color="red"><b>"+this.AspNetPagerView.CurrentPageIndex.ToString()+"</b></font>"; this.AspNetPagerView.CustomInfoText+=" 总页数:<font color="blue"><b>"+this.AspNetPagerView.PageCount.ToString()+"</b></font>"; this.AspNetPagerView.CustomInfoText+=" 记录总数:<font color="blue"><b>"+this.AspNetPagerView.RecordCount.ToString()+"</b></font>"; } private void AspNetPagerView_PageChanged(object src, Wuqi.Webdiyer.PageChangedEventArgs e) ...{ this.AspNetPagerView.CurrentPageIndex=e.NewPageIndex; this.SetBindData(); System.Text.StringBuilder sb=new System.Text.StringBuilder("<script Language="Javascript"><!-- "); sb.Append("var el=document.all;"); sb.Append(dg.ClientID); sb.Append(".scrollIntoView(true);"); sb.Append("<"); sb.Append("/"); sb.Append("script>"); if(!Page.IsStartupScriptRegistered("scrollScript")) Page.RegisterStartupScript("scrollScript",sb.ToString()); }存储过程:CREATE procedure SP_AspNetPager_Meeting(@pagesize int,@pageindex int,@docount bit)asset nocount onif(@docount=1)select count(id) from Meetingelsebegindeclare @indextable table(id int identity(1,1),nid int)declare @PageLowerBound intdeclare @PageUpperBound intset @PageLowerBound=(@pageindex-1)*@pagesizeset @PageUpperBound=@PageLowerBound+@pagesizeset rowcount @PageUpperBoundinsert into @indextable(nid) select id from Meeting order by id ascselect O.* from Meeting O,@indextable t where O.id=t.nidand t.id>@PageLowerBound and t.id<=@PageUpperBound order by t.idendset nocount offGO