How to know how many checkboxes are checked in gridview

sajeel

Member
Joined
Jul 9, 2008
Messages
17
Programming Experience
Beginner
How to know how many checkboxes are checked in gridview
 
You need to iterate through the rows to find each check box.

VB.NET:
Dim count As Integer = 0
        For Each row As DataGridItem In grvData.Rows
            Dim chkBox As CheckBox = row.FindControl("CHECKBOX")
            If chkBox.Checked Then
                count += 1
            End If
        Next

Something like that should do it.
 
Back
Top