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

ListBoxSelectionMode = MultiExtended and Del

My problem is that if I set ListBoxSelectionMode = MultiExtended on my GridControl and I select a cell in a row, pressing Del cleares the whole row. However, pasting text from the clipboard worx well, t.i. only the currently selected cell gets modified. If no current cell available (I select the whole row by clicking on the row header), only then pasting overwrites each cell in the row. Workaround?

5 Replies

AD Administrator Syncfusion Team June 21, 2005 03:12 AM

Exactly what is the behavior you want to see that you do not see now?


AD Administrator Syncfusion Team June 21, 2005 03:22 AM

If you do not want to clear rows, then you can handle the ClearingCells event and set e.Handled = true, doing nothing in this case.
private void gridControl1_ClearingCells(object sender, GridClearingCellsEventArgs e)
{
	if(e.RangeList.ActiveRange.IsRows)
		e.Handled = true;
}

            


AD Administrator Syncfusion Team June 21, 2005 03:43 AM

I simply want the following if I press Del: If no currentcell exists, then delete each cell in the selection. (This is, when I select a row clicking on the row header.) If there is a currentcell, then only the contents of that cell get deleted.


AD Administrator Syncfusion Team June 21, 2005 04:12 AM

OK, now I can see your point: there''s always a currentcell: if I select the row clicking on the row header, then the header cell will be the currentcell. So, I use the ClearingCell event.


AD Administrator Syncfusion Team June 21, 2005 05:19 AM

I think this event handler will do what you described.
private void gridControl1_ClearingCells(object sender, GridClearingCellsEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.ColIndex > 0 && !cc.IsEditing)
	{
		this.gridControl1[cc.RowIndex, cc.ColIndex].CellValue = null;
		e.Handled = true;
		e.Result = true;
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon