Création d'un modèle de page personnalisée
Verrouillé
-
mercredi 31 mars 2010 13:19Modérateur
Pour afficher des informations telles que le nombre total des pages dans la zone de pager, vous pouvez utiliser l’élément <PagerTemplate>, comme illustré dans l'exemple suivant :
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="ID" AllowPaging="true" PageSize="10" AutoGenerateColumns="true"> <PagerTemplate> <asp:Label ID="LabelCurrentPage" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"> </asp:Label>/ <asp:Label ID="LabelPageCount" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageCount %>"> </asp:Label> <asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page" enabled="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>"><< asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page" enabled="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">< </asp:LinkButton> <asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page" enabled="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">> </asp:LinkButton> <asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page" enabled="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">>> </asp:LinkButton> </PagerTemplate> </asp:GridView>Pour plusieurs informations, visitez la page Foire aux Questions – ASP.NET
Alex Petrescu - MSFT

