We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Special Cell Selections

I need a way to keep the grayed cells (see attached sample) from being selected. I have some code commented out in the selection changing event that almost works but I want the first 32 cells in column 1 & column 2 to be selected when the user clicks the column header. If possible I would like to be able to use the mouse or arrow keys and select all the cells except the grayed ones. Please note I''m using an, Essential Grid version, GridControl with Visual Basic.Net not a DataBoundGrid with C code. Please note the difference when sending me samples. Thank you, John SpecialCellSelectionChanging_4598.zip

1 Reply

AD Administrator Syncfusion Team May 27, 2004 07:22 PM UTC

Try this code.
  Private Sub grdCreditPDS_SelectionChanging(ByVal sender As System.Object, ByVal e As GridSelectionChangingEventArgs)

        If (e.Range.Contains(GridRangeInfo.Col(1)) Or e.Range.Contains(GridRangeInfo.Col(2))) Then
            e.Range = GridRangeInfo.Cells(1, e.Range.Left, 32, e.Range.Right)
        End If

        If (e.Range.IntersectsWith(GridRangeInfo.Cells(33, 1, 128, 2))) Then
            e.Cancel = True
        End If

    End Sub

Live Chat Icon For mobile
Up arrow icon