This is a migrated thread and some comments may be shown as answers.

DataGridView issue

1 Answer 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anup
Top achievements
Rank 1
Anup asked on 18 May 2015, 12:07 PM

I have some columns in datagridview which can be edited. When i select a row by clicking anywhere on the row and then single click on a cell to edit, the row selection goes away.But when we double click on the cell the cell becomes editable. I also have  a checkbox to select a row. Currently selection mode property of the grid is multiple.    Is there a way by which single clicking on a cell will not result in deselection of the  row?

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 19 May 2015, 12:35 PM
Hello Anup,

Entering edit mode of GridViewCell should not deselect the row. You can observe this, for example, by subscribing to CellValidating event of RadGridView, which is fired when the control is still in edit mode. By using GridViewCellValidatingEventArgs within the event handler, you can easily inspect the needed properties of GridViewCell and GridViewRow. Please check the code snippet below:
void clubsGrid_CellValidating(object sender, GridViewCellValidatingEventArgs e)
{
    var row = e.Row;
 
    if (row != null)
    {
        bool isRowSelected = row.IsSelected;
        bool isInEditMode = e.Cell.IsInEditMode;
    }
}

Am I missing something?

Best Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Anup
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or