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

ListView+DataPager 分页性能如何?
我看示例代码ListView的数据源都是select * from users,那就是把所有的数据都放到内存中。然后才能使用ListView加上DataPager联合起来实现分页?

我想点击特定的页码时,才查询数据库,返回出该页的数据,这样能使用ListView+DataPager实现分页么?

如果可以,如何实现?烦请给出前台代码,存储过程我知道如何写。

------解决方案--------------------
没用过 只用过aspnetpager
------解决方案--------------------
我们一直用 aspnetpager
------解决方案--------------------
PagedDataSource,数据不多的话可以用!
大量数据还是建议用存储过程
HTML code
  <table style="width:700px; text-align:center">
           <tr>
              <td bgcolor="#006600" style="color:White">
                  第<asp:Label ID="lblCurrent" runat="server">1</asp:Label>页/共
                     <asp:Label  ID="lblCount" runat="server"></asp:Label>页
                        <asp:LinkButton ID="lkbFirst" CausesValidation="false" runat="server" 
                      onclick="lkbFirst_Click">首页</asp:LinkButton>
                          <asp:LinkButton ID="lkbPrev" CausesValidation="false" runat="server" 
                      onclick="lkbPrev_Click">上一页</asp:LinkButton>
                            <asp:LinkButton ID="lkbNext" CausesValidation="false" runat="server" 
                      onclick="lkbNext_Click">下一页</asp:LinkButton>
                              <asp:LinkButton ID="lkbLast" CausesValidation="false" 
                      runat="server" onclick="lkbLast_Click">末页</asp:LinkButton>
                             
              </td>
           </tr>
         </table>

------解决方案--------------------
除非你保证数据量很小,否则就只是应该每次查询仅仅查一页数据。

你看的什么“示例”?可以看看它还有没有下一章节,关于大数据量时使用ListView+DataPager分页处理的示例。