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

Disabling specific range selection

How can i disable a certain range in a grid. For example i want to disable coulum 2 but only row''s 11 to 40 in column 2 if certain criteria is met. I set the clickable and enabled to false and have it set to read only but the user can still drage the mouse over a range and have it highlight. They can also click the ctrl key or shift key to select a range. Can i stop that just for this range so they can do nothing at all to this range?? This is using a non data bound grid and in visual basic. Thanks Phil

2 Replies

AD Administrator Syncfusion Team February 26, 2004 01:59 PM UTC

You can try cancelling the SelectiionChanging event if the range passed in intersects the cells you do not want to select.
Private Sub gridControl1_SelectionChanging(sender As Object, e As GridSelectionChangingEventArgs) handles gridControl1.SelectionChanging
    
   ''don''t select any cell in row 3
   
   If e.Range.IntersectsWith(GridRangeInfo.Row(3)) Then
      e.Cancel = True
   End If 
End Sub ''gridControl1_SelectionChanging 


PB Philip Bishop February 26, 2004 03:49 PM UTC

Thanks Clay. I took your code and changed it around to look like the code below and it works fine. If e.Range.IntersectsWith(GridRangeInfo.Col(2)) And e.Range.IntersectsWith(GridRangeInfo.Rows(11, 40)) Then e.Cancel = True End If Thanks again

Loader.
Up arrow icon