Salut,
J'ai un souci avec tout mes Datagrid. En fait, j'ai le tri par colonne et la pagination qui ne marche pas et pourtant, j'ai mis les 2 propriétés AllowPaging et AllowSorting a True. Voici a quoi ressemble mon DataGrid :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 asp:datagrid id="dgStat" runat="server" Width="100%" CellPadding="4" BackColor="White" BorderColor="#DEDFDE" ForeColor="Black" AllowSorting="True" GridLines="Vertical" BorderWidth="1px" BorderStyle="None" AllowPaging="True"> <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#CE5D5A"></SelectedItemStyle> <AlternatingItemStyle BackColor="White"></AlternatingItemStyle> <ItemStyle BackColor="#F7F7DE"></ItemStyle> <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#6B696B"></HeaderStyle> <FooterStyle BackColor="#CCCC99"></FooterStyle> <PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#F7F7DE" Mode="NumericPages"></PagerStyle> </asp:datagrid>
Je vous informe que je rajoute manuellement les lignes au dataGrid, meme les noms de colonnes sont personnalisées. SI vous voulez voir le code qui remplit le datagrid, je vous le montre. Sinon voici le code de pagination et du tri :
Pagination :
Tri : cette fonction est encore incomplete :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 Private Sub dgStat_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgStat.PageIndexChanged Try dgStat.CurrentPageIndex = e.NewPageIndex ' On teste si on doit activer le bouton Export vers CSV Dim myDataTable As DataTable = CType(Me.getVariableSession("myDataTable"), DataTable) tabRow = CType(Me.getVariableSession("tabRow"), Integer()) CreatDataGrid(myDataTable) 'dgStat.DataBind() Catch ex As Exception System.Diagnostics.Debug.Write(ex.Message) End Try End Sub
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 Private Sub dgStat_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dgStat.SortCommand SortField = e.SortExpression End Sub
Partager