Rows the rows of a grid view?

J

Jason James

Hi,

I would like to do this:

Dim r As GridViewRow
Dim nTotal As Single = 0
For Each r In GridView1.Rows
If IsNumeric(r.Cells(2)) Then
nTotal += CType(r.Cells(2).Text, Single)
End If
Next
Label1.Text = "Total vouchers bought is " & nTotal.ToString

to sum the numbers in column 2 and place the total into Label1.

However, the rows collection doesn't appear to have any rows in it. It
does have rows and they are displayed.

Any ideas how I achieve this goal and in which event I should process
the rows?

Many thanks,

Jason.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top