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

Selecting rows via cells

I have a grid derived from GridControl. Under certain circumstance, I want selection of a cell to actually select the entire row and sometimes multiple rows. How would I handle this? If I handle the SelectionChanging event can I then modify the range that''s passed in? What is the proper way to set the selection to one or more entire rows?

3 Replies

AD Administrator Syncfusion Team October 4, 2004 12:51 PM UTC

>> If I handle the SelectionChanging event can I then modify the range that''''s passed in? Yes, you can modify e.Range. But make sure you test it for not being empty. This event is raised when selections are cleared with e.Range = empty.


AD Administrator Syncfusion Team October 4, 2004 03:03 PM UTC

I''m getting some unusual behavior. When I select a cell, the SelectionChanging event gets called with the Empty but not with the cell selection. Row selection (which is also enabled) works fine. The SelectionChanging gets called with empty to remove the previous selection and then it gets called again with the new selection. AllowSelection is set to Row | Cell Pete


AD Administrator Syncfusion Team October 4, 2004 03:56 PM UTC

By selecting a cell, do you mean making it the current cell? If so, the default behavior is to not include the currentcell as part of the selections. (Being the currentcell and being selected are not treated as the same thing.) If you set ExcelLikeCurrentCell, then the current cell will be treated as part of the selections. You may also want to turn on ExcelLikeSelectionFrame in this case also. If you do not want this look, then you could try handling CurrentCellMoved, and if the current cell is not part of the selections, then explicilty add it to the selections.

Loader.
Live Chat Icon For mobile
Up arrow icon