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.
Unfortunately, activation email could not send to your email. Please try again.

Ignoring selections on rows

Thread ID:

Created:

Updated:

Platform:

Replies:

7082 Sep 11,2003 07:10 AM Sep 11,2003 07:28 AM Windows Forms 1
loading
Tags: GridControl
Jimmy
Asked On September 11, 2003 07:10 AM

I am trying to do some special handling of selections with the SelectionChanging and SelectionChanged events. I am using the: ListBoxSelectionMode = SelectionMode.MultiExtended; My SelectionChanged code looks something like this (simplyfied): if ( e.Range.Top == 2 ) { e.Cancel = true; } Now the problem is that if my previous selection was say row 3 and 4 and I click row 2. The previous selection is cleared. I'd like to just ignore the click on row 2 and keep the valid selection (3,4). I am sure that must be something simple. Thanks

Administrator [Syncfusion]
Replied On September 11, 2003 07:28 AM

In addition to cancelling the new selection, you also have to cancel the de-selection of the old range which you use e.Range.IsEmpty to test for.
private void gridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
	if(e.Range.IsEmpty && e.ClickRange.IntersectsWith(GridRangeInfo.Row(2)))
		e.Cancel = true;
	else if(e.Range.IntersectsWith(GridRangeInfo.Row(2)))
		e.Cancel = true;
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;