Daily Archives: June 16, 2008

1 post

Find the index of the GridView row where embeded CheckBox fired event

Say you have a GridView control with a CheckBox column embedded. When the check box is checked, it fires an event. How can you find out the index of the corresponding row that contains the check box? Here is the code snippet: VB.NET code: Protected Sub chkSelect_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim cb As CheckBox = CType(sender, CheckBox) Dim gr As GridViewRow = CType(cb.NamingContainer, GridViewRow) If (gr IsNot Nothing) Then Dim i […]