Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how would I take extlabel text and add it together to the next row and at the end I would have one value?

extlabel is in template field

example:
total column
$200.00
$225.00
$100.00
$700.00


VB
Dim p As String = String.Empty
        For Each row As GridViewRow In GridView1.Rows
            Dim quantlabel As Label = DirectCast(row.FindControl("quantlabel"), Label)
            Dim extlabel As Label = DirectCast(row.FindControl("extlabel"), Label)
            
            If quantlabel.text > 0 Then
                p + extlabel.text
            Else

            End If

        Next
Posted

1 solution

Nevermind, I figured it out.

VB
Dim p As Decimal = 0
        For Each row As GridViewRow In GridView1.Rows
            Dim quantlabel As Label = DirectCast(row.FindControl("quantlabel"), Label)
            Dim extlabel As Label = DirectCast(row.FindControl("extlabel"), Label)
            
            If quantlabel.Visible = True Then
                Dim q As Decimal = extlabel.Text
                p = p + q
            Else

            End If

        Next
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900