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

How do I detect GridRangeInfoList crossing column boundaries?

I have a GDBG that I want to allow the user to multi select rows within a column and then perform a right mouse click action on all rows selected. I''ve got that all working fine, but my problem is how do I prevent them from selecting cells from multiple columns? Each column in the grid allows a different right mouse click action so having cells selected from multiple columns would be confusing. What I would like to do is if the user has crossed column boundaries, clear the previous range. I''m having a hard time finding an event to use to capture this situation. Also note they could be selecting via a drag or shift/ctrl-click. Any idea what event(s) to use?

2 Replies

AD Administrator Syncfusion Team January 20, 2005 12:26 PM UTC

Try handling the SelectionChanging event and cancelling it if e.Range is more that 1 column wide.
private void Model_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
	if((e.Range.IsCols || e.Range.IsCells) 
		&& e.Range.Left != e.Range.Right)
	{
		e.Cancel = true;
	}
}


RI Rick January 20, 2005 02:00 PM UTC

Works beautifully if you are dragging, but does not handle the ctrl-click. This is a great start though, I should be able to figure out the rest from here. Thanks for the prompt reply!!!

Loader.
Live Chat Icon For mobile
Up arrow icon