Salut à tous,
j'ai une datatable qui alimente un gridview. Je souhaiterais avoir une ligne totale qui est la somme de chaque champ numerique sur mon gridview.
Le problème que jai est pour certains champ sa marche sans problème mais pour d'autre c'est seulemnt la première ligne qui est repercutée dans TOTAL.
J'avous que je ne comprends pas surtout que cest la meme fonction qui fait le calcul partout.
Aidez moi s'il vous plais.
Pour information, voici la fonction de calcul des pageFooter.

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
16
17
18
19
20
21
22
Public Sub Footer_total(ByRef grid As GridView, ByVal col_debu As Integer, Optional ByVal col_fin As Integer = 0) ' As Integer
        If grid.Rows.Count - 1 > 0 Then
            Dim total As Double = 0 'integer
            If col_fin = 0 Then
                col_fin = col_debu
            End If
            Try
                For i As Integer = col_debu To col_fin
                    For j As Integer = 0 To grid.Rows.Count - 1
                        If IsNumeric(grid.Rows(j).Cells(i).Text) Then
                            total += grid.Rows(j).Cells(i).Text
                        End If
                    Next
                    grid.FooterRow.Cells(i).Text = String.Format("{0:N3}", total)
                    total = 0
                Next
            Catch ex As Exception
                MsgBox("Footer_total  :  " & ex.Message)
                _errormsg &= "Footer_total  :  " & ex.Message & " <br/>"
            End Try
        End If
    End Sub