日期:2014-05-19  浏览次数:20400 次

一个简单的分页,那里出错了呢?
前台:
<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeFile= "temp.aspx.cs "   Inherits= "bms._temp "   %>
<!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 "   >
<head   runat= "server ">
        <title> 无标题页 </title>
</head>
<body>
        <form   id= "form1 "   runat= "server ">
        <asp:Label   ID= "lbl "   runat= "server "> </asp:Label> <br>
        <asp:linkbutton   id= "btnFirst "   onclick= "PagerButtonClick "   runat= "server "   CommandArgument= "1 "> </asp:linkbutton>
        <asp:linkbutton   id= "btnPrev "   onclick= "PagerButtonClick "   runat= "server "   CommandArgument= "prev "> </asp:linkbutton>
        <asp:linkbutton   id= "btnNext "   onclick= "PagerButtonClick "   runat= "server "   CommandArgument= "next "> </asp:linkbutton>
        <asp:linkbutton   id= "btnLast "   onclick= "PagerButtonClick "   runat= "server "   CommandArgument= "last "> </asp:linkbutton>
        </form>
</body>
</html>

后台:
using   System;
using   System.Data;
using   System.Configuration;
using   System.Collections;
using   System.Web;
using   System.Web.Security;
using   System.Web.UI;
using   System.Web.UI.WebControls;
using   System.Web.UI.WebControls.WebParts;
using   System.Web.UI.HtmlControls;
namespace   bms
{

        public   partial   class   _temp   :System.Web.UI.Page
        {
                int   destpage;
                protected   void   Page_Load(object   sender,   EventArgs   e)
                {
                        if   (!IsPostBack)
                    {  
                        ViewState[ "PageIndex "]   =1;
                        btnFirst.Text   =   " <首页> ";
                        btnPrev.Text   =   " <上一页> ";
                        btnNext.Text   =   " <下一页> ";
                        btnLast.Text   =   " <末页> ";