Somma su gridview ?

martedì 19 febbraio 2013 - 18.06

jjchuck Profilo | Senior Member

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è????
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5