GridView自带分页功能代码(页面)

 

<PagerTemplate>
                <table width="100%">
                    <tr>
                        <td align="right">

                         第<asp:Label ID="lblPageIndex" runat="server" Text='<%#((GridView)Container.Parent.Parent).PageIndex + 1 %>'></asp:Label>页
                         &nbsp;共<asp:Label ID="lblPageCount" runat="server" Text='<%#((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>页
                         &nbsp;每页<asp:Label ID="Label1" runat="server" Text='<%#((GridView)Container.Parent.Parent).PageSize %>'></asp:Label>条
                         &nbsp;<asp:LinkButton Text="首页" ID="btnFirst" runat="server" CausesValidation="false"
                                    CommandArgument="First" CommandName="Page" />
                        &nbsp;<asp:LinkButton Text="上一页" ID="btnPre" runat="server" CausesValidation="false"
                                    CommandArgument="Prev" CommandName="Page" />
                        &nbsp;<asp:LinkButton Text="下一页" ID="btnNext" runat="server" CausesValidation="false"
                                     CommandArgument="Next" CommandName="Page" />
                        &nbsp;<asp:LinkButton Text="尾页" ID="btnLast" runat="server" CausesValidation="false"
                                    CommandArgument="Last" CommandName="Page" />

                      </td>
                  </tr>
              </table>

</PagerTemplate>

posted @ 2012-03-21 13:15  玉面麒麟  Views(516)  Comments(0Edit  收藏  举报