I needed to calculate the total first :-)..... Anyway got it
<asp:DataGrid OnItemDataBound="CalculateTotal"....
Sub CalculateTotal(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Then
Dim Count As Decimal = Convert.ToDecimal(DataBinder.Eval(e.Item.DataItem,
"ItemTotal"))
Total += Count
ElseIf e.Item.ItemType = ListItemType.Footer Then
e.Item.Cells(6).Text = String.Format("{0:c}", Total)
End If
End Sub
Cheers,
Jon
"Andrew de la Harpe" <an*********@hotmail.com> wrote in message
news:Oi**************@TK2MSFTNGP12.phx.gbl...
Insert the total into the footer
A
"Jon" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:uA**************@TK2MSFTNGP11.phx.gbl... Hi,
Working on a shopping cart app. I'm using a datagrid on the shopping
cart page with boundcolumns to display Product name, cost, quantity etc -
that all works fine. However I want to add a row to the bottom of the grid to
display cart total, so I'd end up with something like this
Product Cost Quantity Sub Total
Product1 10.22 1 10.22
Product2 5.00 2 10.00
Cart Total 20.22
So my question is how do I add a row to the bottom of the datagrid to
display the total?
Cheers,
Jon