Using both static data and data from some GridView cells I am attempting to calculate a result in a Template Cell - but to no avail!
The value for TextBox1 is brought in on the page_load event and I'm attempting the balance of the calculation uisng the ItemDataBound event :-
But the calculated cells are always empty at run time! Any ideas what where I'm going wrong?
The value for TextBox1 is brought in on the page_load event and I'm attempting the balance of the calculation uisng the ItemDataBound event :-
Code:
Protected Sub GridView1_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim vInterest As Single = TextBox1.Text / 100.0#
Dim vRate As Single = 1.0#
Dim vRemLife As Single = e.Item.Cells(3).Text
Dim vCostAv As Single = e.Item.Cells(4).Text
Dim vNum As Integer
For vNum = 1 To vRemLife
vRate = vRate * (1 + vInterest)
Next vNum
Dim vInsert As Single = Format(vCostAv * vRate, "###.##.0.00")
e.Item.Cells(5).Text = vInsert
End If
Comment