bonjour à tous et à toutes,
je viens de débuter en c# et j'ai crée une Datagrid qui affiche les données d'une table sqlserver et je voudrais la paginer.
la fonction c# :
Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 protected void NewPage(object b, DataGridPageChangedEventArgs c) { maGrille.CurrentPageIndex = c.NewPageIndex; maGrille.DataBind(); }
la page .aspx :
Code aspx : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 <body> <form id="form1" runat="server"> <div id="divaff" runat="server"> <asp:datagrid runat="server" id="maGrille" BackColor="Beige" CellPadding="4" BorderColor="#000004" AllowPaging="True" OnPageIndexChanged="NewPage" AllowCustomPaging="True" AllowSorting="True" PageSize="20" > <HeaderStyle BackColor="Brown" ForeColor="White" Font-Bold="True" HorizontalAlign="Center"> </HeaderStyle> <AlternatingItemStyle BackColor="White" /> <PagerStyle Mode="NumericPages" HorizontalAlign="Center" NextPageText=">>" PrevPageText="<<" Position="TopAndBottom" /> </asp:datagrid> </div> <asp:Button ID="envoyer" Text="Afficher" runat=server OnClick="Afficher" /> </form> </body>
finalement la pagination ne s'applique que sur la première page de ma DataGrid, quelqu'un peut m'aider s'il vous plait?
Partager