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

Customized row selection behavior in DataBound grid

I need to implement the following customized selection behavior: 1) single click on row header column selects/unselects row (as in ListBoxSelectionMode == SelectionMode.MultiSimple 2) clicking on a non-row header column does not affect selection I attempted to achieve this by setting SelectionMode to MultiSimple, handling SelectionChanging and canceling selection if user clicked outside the row header column, but both CurrentCell and MouseDown location are apparently not yet set when SelectionChanging is fired. What would be the alternatives to try? Gene Gorokhovsky DataBoundGrid v 1.6.1.6

2 Replies

AD Administrator Syncfusion Team October 3, 2003 02:36 PM UTC

It looks like you completely want to override the default selection behavior. In that case I suggest disabling the MouseController that handles mouse selections. Do that with Grid.Model.Options.ControllerOptions &= ~GridControllerOptions.SelectCells; Now that you have turned off default selection mechanism you can add your own cell selection logic by handling the CellClick event and setting/resetting with SelectRange calls. If that is not good for you need to take a close at the SelectionChanging event. One of its args is a reason. There you can try cancelling resetting selection, adding selections etc. But you have to take a good look and add some Trace output when this event is called. Not sure if it will get you all the way to what you want to implement but also worth a try. Stefan


GG Gene Gorokhovsky October 9, 2003 03:13 PM UTC

I was able to implement required behavior by checking Cursor.Position in SelectionChanging, and canceling it when cursor is not over row headers. CurrentCell did not work because it is set after SelectionChanging fires. Thanks, Gene

Loader.
Live Chat Icon For mobile
Up arrow icon