Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
How to navigate the Infragistics' WebDataGrid control in the back end looking for the values of an UnboundCheckBoxField column?
posted

This is a fragment of my WebDataGrid:

<ig:WebDataGrid ID="WebDataGrid1" runat="server" >
    <Columns>
        <ig:UnboundCheckBoxField Key="SelectedId" >
        </ig:UnboundCheckBoxField>
    </Columns>
</ig:WebDataGrid>

In the postback I want to iterate all the SelectedId column checking what was checked. I was suggested the following code:

For Each row As WebDataGridRow In WebDataGrid1.Rows
        ' Find the CheckBox control in each row using the field key (assuming "CheckBoxField" is the field key).
        Dim checkBox As WebDataGridCell = TryCast(row.Items.FindItemByKey("CheckBoxField"), WebDataGridCell)

        If checkBox IsNot Nothing AndAlso checkBox.Controls.Count > 0 Then
            Dim checkBoxControl As CheckBox = TryCast(checkBox.Controls(0), CheckBox)

            If checkBoxControl IsNot Nothing Then
                ' Check or uncheck the checkbox based on your logic.
                Dim isChecked As Boolean = checkBoxControl.Checked
                ' You can now use the 'isChecked' variable as needed.
            End If
        End If
    Next

The problem is the compiler says the types WebDataGridRow and WebDataGridCell are not defined, at least with my version of Infragistics (Infragistics45.Web.v21.2, Version=21.2.20212.9) 
Am I missing something?