I have an ASPxGridView that has a SelectCheckBox as the first column. Some of the CheckBoxes are hidden based on some data. The problem is when I click the Select All checkbox, it selects all the rows instead of only the ones that have checkboxes. How can I remedy this problem?
Here is my markup:
ASPx<dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="-1" Width="32">
<HeaderTemplate>
<dx:ASPxCheckBox ID="SelectAllCheckBox" runat="server" ToolTip="Select/Unselect all rows on the page"
ClientSideEvents-CheckedChanged="function(s, e) { grid.SelectAllRowsOnPage(s.GetChecked()); }" />
</HeaderTemplate>
<HeaderStyle HorizontalAlign="Center" />
</dx:GridViewCommandColumn>
Here is my code for hiding the checkboxes:
Visual BasicProtected Sub grid_CommandButtonInitialize(sender As Object, e As ASPxGridViewCommandButtonEventArgs) Handles grid.CommandButtonInitialize
If e.VisibleIndex = -1 Then
Return
End If
Dim fieldValue As Object = grid.GetRowValues(e.VisibleIndex, "StatusCode")
If e.ButtonType = ColumnCommandButtonType.SelectCheckbox Then
If fieldValue = "S" Then
e.Visible = True
Else
e.Visible = False
End If
End If
End Sub