Checkbox in Datagrid silly question

PROKA

Junior Contributor
Joined
Sep 3, 2003
Messages
249
Location
Bucharest
Ok so I created a template Column, from the property builder and I put in the "Item template" a checkbox named CheckBox1

The datagrid has 5 rows ... so there are 5 checkboxes

How do I work with those checkboxes from the code ?

i want to know at certain moments which checkboxes are checked and which are not. Also I want to be able programmaticly to check or uncheck 'em
 
ok meanwhile I found out how . I post the solution for others who might need it

DataGrid1 is my datagrid
chkSelected is my CheckBox

Visual Basic:
    Private Sub ShowSelections()
        Dim dgItem As DataGridItem
        Dim chkSelected As CheckBox

        For Each dgItem In DataGrid1.Items
            chkSelected = CType(dgItem.FindControl("chkSelected"), CheckBox)

            If chkSelected.Checked = True Then
                Label1.Text += " T"
            Else
                Label1.Text += " F"
            End If
        Next
    End Sub
 
Back
Top