JOHNFROG
asked on
How to best count the checked checkboxes in a datagrid after each selection/deselection
I am trying to keep a running total of the number of checkboxes selected in a datagrid. My problem is not in the coding but how to invoke the code after each selection/deselection?
The default event for the checkbox is
Protected Sub CheckBox_Select_CheckedCha nged(ByVal sender As Object, ByVal e As System.EventArgs)
however this event is not triggered when a checkbox is changed.
any clues to why this would not be trigerred? could it be something to do with masterpages? or being inside an accordion control
The default event for the checkbox is
Protected Sub CheckBox_Select_CheckedCha
however this event is not triggered when a checkbox is changed.
any clues to why this would not be trigerred? could it be something to do with masterpages? or being inside an accordion control
' This code works if I request it from a button but the
Protected Sub CheckBox_Select_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim cb As CheckBox
Dim row As GridViewRow
Dim contactCounter As Integer = 0
For Each row In GridView1.Rows
cb = CType(row.FindControl("CheckBox_Select"), CheckBox)
If cb.Checked Then
contactCounter = contactCounter + 1
End If
Next
Label_contactsSelected.Text = contactCounter & " contacts selected"
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER