I'm trying to calculate the total price of all the articles in a dataGrid of a caddy and write it down in the footer...
The problem is that i have to do that dynamical and that my page is rebind all the time (add new row, dropdownlists...)
I've tried it this way but this just don't work... (found example on DataGridGirl...)
Some facts:
* I don't get any message by my debugger, so i guess there are no syntax-faults
* I don't see the string: "Totale prijs" into the footer
* Showfooter is set on true...
Somebody knows how to handle this?
CODE SNIPPET:
Public Sub eventItemDataBound1(ByVal S As Object, ByVal e As DataGridItemEventArgs)
Dim drop1 As DropDownList = e.Item.FindControl("myDDL")
Dim indexInDataGrid As Integer = e.Item.ItemIndex
If Not IsNothing(drop1) Then 'zeer belangrijk => drop1 moet eerste bestaan!!!
...
' I Add dropdown here to the DataGrid...
...
'Bereken de Totale Som
Dim myTable As DataTable = myDataSet.Tables("OrderTabel")
Dim myDataRow As DataRow
Dim som As Double = 0
If (e.Item.ItemType = ListItemType.Footer) Then
For Each myDataRow In myTable.Rows
som = som + myTable.Rows(indexInDataGrid)("totaleprijs")
Next
e.Item.Cells(1).Text = "Totale prijs:"
e.Item.Cells(7).Text = som
End If
End If
End Sub