Reputation: 4559
I need to create table where all rows are inside <tbody></tbody>
and last row (Total with sums of columns) is inside <tfoot></tfoot>
.
Can I put last row of DataTable
(which is bound to the Repeater
) into the footer, where I can define appropriate template?
Upvotes: 0
Views: 1793
Reputation: 460128
I would suggest to sum the columns via DataTable.Compute in ItemDataBound of the Repeater.
For example(VB.NET, not tested, assuming there is a column named 'Total'):
Sub R1_ItemDataBound(Sender As Object, e As RepeaterItemEventArgs)
If (e.Item.ItemType = ListItemType.Footer) Then
Dim tbl = DirectCast(DirectCast(sender, Repeater).DataSource, DataTable)
Dim total = DirectCast(tbl.Compute("Sum(Total)", Nothing), Double)
' show this value in appropriate cell/control in footer '
End If
End Sub
Upvotes: 3