Questo codice che posto funziona in cento gridview che ho ma non in uno che proprio mi serve...mi restituisce €0 ...
su GridView1_RowDataBound inserisco...
Dim totale as decimal=0
If e.Row.RowType <> DataControlRowType.Header Then
If e.Row.RowType = DataControlRowType.DataRow Then
If Convert.ToDecimal(e.Row.Cells(3).Text) < 0 Then
e.Row.Cells(3).ForeColor = Drawing.Color.Red
End If
Totale += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "importo"))
ElseIf e.Row.RowType = DataControlRowType.Footer Then
e.Row.Cells(3).Text = "€ " + Totale.ToString()
If Convert.ToDecimal(Totale) < 0 Then
e.Row.Cells(3).ForeColor = Drawing.Color.Red
End If
e.Row.Font.Bold = True
End If
End If
cosa può essere che non va...?
correggo la mia domanda: se dichiaro fuori dalla sub il totale allora funziona!!!
perchè????