日期:2014-05-17  浏览次数:20403 次

求助!ASP.NET怎么实现分页?
求助大神!ASP.NET怎么实现分页?
具体:从数据库调出来的数据要求分页呈现。每10条一页。(不想用控件,控件的美观很难调整)
数据表为comments,表内字段为id,text,time,name.
谢谢!

------解决方案--------------------
sql语句分页绑定啊,不过也得勇哥控件显示几页的吧!!
------解决方案--------------------
可以使用aspnetpager分页控件。
http://www.webdiyer.com/downloads/
http://blog.csdn.net/chinacsharper/article/details/9095387
------解决方案--------------------
<webdiyer:AspNetPager ID="anp" runat="server" AlwaysShow="True" CustomInfoHTML="总共%RecordCount%条记录,第%CurrentPageIndex%页/共%PageCount%页"
        FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" OnPageChanged="anp_PageChanged"
        PageSize="15" PrevPageText="上一页" ShowCustomInfoSection="Left" ShowMoreButtons="False"
        ShowPageIndex="False" ShowPageIndexBox="Always" SubmitButtonText="GO" TextAfterPageIndexBox="页" SubmitButtonClass="ttn"
        TextBeforePageIndexBox="转到第" PageIndexBoxClass="inpu">
    </webdiyer:AspNetPager>


开头添加:<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
------解决方案--------------------
            int PagSize = 10;
            if (Request.Form["rows"] != null)
                PagSize = Convert.ToInt32(Request.Form["rows"]);
            int PagIndex = 1;
            if (Request.Form["page"] != null)
                PagIndex = Convert.ToInt32(Request.Form["page"]);
            int RowCount = -1;
            if (Request.Form["rowcount"] != null)
                RowCount = Convert.ToInt32(Request["rowcount"]);
            string orderstr = "";
            if (Request.Form["sort"] != null)
                orderstr = Request.Form["sort"] +&nbs