locked
Dividing Gridview cell values RRS feed

  • Question

  • User-809753952 posted

    I have a gridview with two rows filled in. I need to divide each cell values in the first two rows and show the result in the third row cells.

    Gridview is populated dynamically in using code behind. 

    My Gridview looks like this:

    ID Column1 Column2 Column3 Column4 Grand Total
    1 916 61 133 110 2220
    2 1467 967 1567 1818 18644
    3 = 916/1467 = 61/967  = 133/1567 = 110/1818 = 2220/18644
    Wednesday, January 31, 2018 11:49 AM

Answers

  • User-809753952 posted

    I found the answer:

    GridView2.Rows(2).Cells(1).Text = Math.Round((GridView2.Rows(0).Cells(1).Text / GridView2.Rows(1).Cells(1).Text) * 100, 2) & "%"

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 31, 2018 12:24 PM