Rows the rows of a grid view?

Discussion in 'ASP .Net' started by Jason James, Aug 10, 2006.

  1. Jason James

    Jason James Guest

    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.
     
    Jason James, Aug 10, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stuart Shay
    Replies:
    3
    Views:
    13,202
    Darkmoor
    Aug 20, 2010
  2. Luqman
    Replies:
    2
    Views:
    3,843
    Luqman
    Feb 1, 2006
  3. Seema Multani

    Clickable rows in Grid View

    Seema Multani, Aug 28, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    518
    Mark Rae
    Aug 29, 2006
  4. wahtnamas
    Replies:
    0
    Views:
    917
    wahtnamas
    May 1, 2009
  5. Parthiv Joshi
    Replies:
    1
    Views:
    751
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page