Jeud: Adding total field to DataGrid
Dear All.
I'm having problem on creating a DataGrid with some total fields at the
bottom area of the grid.
Inside the <asp:DataGrid> tag, I have assigned an event handler as follow
....
OnItemDataBound="MyDataGrid_ItemDataBound"
....
This is what MyDataGrid_ItemDataBound looks like.
Sub MyDataGrid_ItemDataBound(Sender As Object, E As DataGridItemEventArgs)
If (E.Item.ItemType = ListItemType.Item) Or (E.Item.ItemType =
ListItemType.AlternatingItem) Then
'I was noticed that E.Item.Cells(1) is still blank here, therefore I
just couldn't retrieve any value for my calculation sub routine
MyCalculationSubRoutine(E.Item.Cells(1).Text)
Else
'I plan to assign the total back to footer this way
'E.Item.Cells(1).Text + String.Format("{0:c}", GrandDailySales)
End If
End Sub
My question is that how to get the value from E.Item.Cells(1) on each row ?,
because I have to pass the value I read to MyCalculatioSubRoutine for
calculating the total.
Actually I got this coding idea from MSDN, but why my one isn't working?
Is it because I placed the coding at the wrong event, or whatever?
Please anyone suggest me what to do, I don't mind if I have to entirely
change the way to code this page to make this all work out.
Thanks.
TJeudSanit
* Preferably is vb.
** I'm actually using simple text editor to code my asp.net pages.