DataGridView issue

2 posts, 0 answers
  1. Anup
    Anup avatar
    1 posts
    Member since:
    May 2015

    Posted 18 May 2015 Link to this post

    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?


  2. Stefan
    Stefan avatar
    1073 posts

    Posted 19 May 2015 Link to this post

    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,
    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
Back to Top