I am having problems displaying totals of my decimal columns (sums of columns from SQL Query). I am not certain how it should be done and the error I am getting is:
The first two work fine, probably because they are coming from the database as integers. But even when I try to change #3 and #4 to decimals I get the same error - like this:
What am I doing wrong?
Input string was not in a correct format.
If (TypeOf e.Item Is GridDataItem) Then |
Dim dataItem As GridDataItem = CType(e.Item, GridDataItem) |
Dim fieldValue As Integer = Integer.Parse(dataItem("Total Leads").Text) |
Leadtotal = (Leadtotal + fieldValue) |
Dim fieldValue2 As Integer = Integer.Parse(dataItem("Credit Count").Text) |
CreditTotal = (CreditTotal + fieldValue2) |
Dim fieldValue3 As Integer = Integer.Parse(dataItem("Our Cost").Text) |
OurCostTotal = (OurCostTotal + fieldValue3) |
Dim fieldValue4 As Integer = Integer.Parse(dataItem("Resale Amount").Text) |
ResaleTotal = (ResaleTotal + fieldValue4) |
End If |
If (TypeOf e.Item Is GridFooterItem) Then |
Dim footerItem As GridFooterItem = CType(e.Item, GridFooterItem) |
footerItem("Total Leads").Text = Leadtotal.ToString() |
footerItem("Credit Count").Text = CreditTotal.ToString() |
footerItem("Our Cost").Text = OurCostTotal.ToString() |
footerItem("Resale Amount").Text = ResaleTotal.ToString() |
End If |
The first two work fine, probably because they are coming from the database as integers. But even when I try to change #3 and #4 to decimals I get the same error - like this:
Dim fieldValue3 As Decimal = Decimal.Parse(dataItem("Our Cost").Text) |
OurCostTotal = (OurCostTotal + fieldValue3) |
Dim fieldValue4 As Decimal = Decimal.Parse(dataItem("Resale Amount").Text) |
ResaleTotal = (ResaleTotal + fieldValue4) |
What am I doing wrong?