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

Bug in GridDataBound 2.0.2.1

I have discovered a bug with selections in GridDataBoundGrid. To replicate this bug try the following steps: create a GridDataBoundGrid and ensure that it has some data in it whilst holding down Ctrl, select a single cell still holding Ctrl, select another other single cell still holding Ctrl, select the first cell again still holding Ctrl select the second cell again repeat as often as you like Now look at _grid.Selections.Ranges.Info property. You will see that rather than each cell being added only once, they are each present multiple times. If you need more info, just ask. Sam

1 Reply

AD Administrator Syncfusion Team March 11, 2004 03:31 AM

Pressing control will allow you to add the sane range twice. This is by design. (Without this, it would be difficult to add two different ranges that intersect using the control key). If you do not want this behavior, then you can handle the SelectionChanging event (Model.SelectionChanging in GridDataBoundGrid), and cance the selection if it is a control-click into a selected cell.
private void gridControl1_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
	bool ctl = (Control.ModifierKeys & Keys.Control) != 0;
	if(ctl && e.Range.Height == 1 && e.Range.Width == 1)
	{
		if(this.gridControl1.Selections.Ranges.IndexOf(e.Range) > -1)
			e.Cancel = true;
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon