need to count rows for particular columns if no data then ignore and count

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agrace

    need to count rows for particular columns if no data then ignore and count

    I have the following table:

    Code:
    A          B            C
    
    1          0            0
    0          1            1
    0          0            0
    1          1            0
    I would like to calculate the sum of each columns and display the results in the footer.

    So the count displayed in the the footer that I would like to show would look like this for my table
    Code:
    A          B            C
    
    1          0            0
    0          1            1
    0          0            0
    1          1            0
    ===========================
    2           2           1


    The data already bound to the grid.

    Now, how do I use the RowDataBound event to accomplish this using vb.net?
    Last edited by Frinavale; Oct 6 '10, 04:05 PM. Reason: Rewrote the question so that it makes more sense.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Declare some class level variables that will keep track of the sums for each column.

    For example:
    Code:
    Dim columnASum As Integer
    Dim columnBSum As Integer
    Dim columnCSum As Integer
    During the RowDataBound event, retrieve the data from each column and add it to the appropriate sum.

    I'm not sure if you are developing an ASP.NET application or a Win-forms desktop application so I cannot help you any further at this point.

    What have you tried so far to solve the problem?

    -Frinny

    Comment

    Working...