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

select rows, cell and delete

Hi, I have a problem with select and delete rows,cell. I want to MultiSel in GridDataBoundGrid, and while click cell,it will hilight the cell and clean the cellvalue if press del key, only click the row header can delete the selected rows. in order to multisel, i set grid.ListBoxSelectionMode = SelectionMode.MultiExtended, but in this way,while click cell,it will select a row other than the current cell,and will delete the row if press the del key. then,i set grid.AllowSelection = GridSelectionFlags.Any & (~GridSelectionFlags.Row) but it doesn''t work well. please help me. Thanks!

5 Replies

AD Administrator Syncfusion Team April 12, 2004 08:17 AM UTC

I am not sure what is the exact behavior you want. If you do not want to delete the whole row if you have an active currentcell, then you can handle this in RowsDeleting. You could just cancel it, but if you want the delete key to delete the text then you would have to do a little more work. private void gridDataBoundGrid1_RowsDeleting(object sender, GridRowRangeEventArgs e) { if(this.grid.CurrentCell.IsEditing) { e.Cancel = true; GridTextBoxControl tb = this.grid.CurrentCell.Renderer.Control as GridTextBoxControl; if(tb.SelectionLength == 0) tb.SelectionLength = 1; tb.SelectedText = ""; } }

AD Administrator Syncfusion Team April 12, 2004 10:15 PM UTC

hi,clay my expression is not very clear. my purpose is want to multisel the rows in the GDBG,and i want this happens only while click on row header,and do not select the whole row while click a cell. how could i do?

AD Administrator Syncfusion Team April 13, 2004 06:02 AM UTC

Try turning off grid.ListBoxSelectionMode. Otherwise, clicking on the any cell will select any row. And in the grid.AllowSelection property, turn off the Column and Cell flags. I think this should only allow you to select rows by clicking/drag-selecting the headers.

AD Administrator Syncfusion Team April 13, 2004 10:27 PM UTC

hi, clay But if I turn off grid.ListBoxSelectionMode, the grid can not multiselrows by shift or ctrl key. I set grid.AllowSelection,but it doesn''t work on multisel mode. why? How should I do?

AD Administrator Syncfusion Team April 13, 2004 11:15 PM UTC

I find my mistakes, and correct it. Thanks a lot!

Live Chat Icon For mobile
Up arrow icon