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.
Unfortunately, activation email could not send to your email. Please try again.

How to deselect the rows in the grid programmatically?

In GridDataBoundGrid selection can be cleared by using Selection.Clear() method. The Clear method of ranges is used to remove the collection along from the Ranges collection where the Selection.Clear() is used to remove all selection from Grid.

 

 

While sorting the column using cell click on header cell, Current cell is moved to first cell if grid doesn’t has any current cell. Due to this, selection also moved to the first row. You can avoid this issue by using CurrentCellMoving event.

 

this.gridDataBoundGrid1.CurrentCellMoving += gridDataBoundGrid1_CurrentCellMoving;

 

void gridDataBoundGrid1_CurrentCellMoving(object sender, GridCurrentCellMovingEventArgs e)

{

    if (e.RowIndex == 1)

    {

        e.Cancel = true;

    }

}

 

 

Sample

GridDataBoundGridSelection_C#

GridDataBoundGridSelection_VB

Article ID: Published Date: Last Revised Date: Platform: Control:
6885 05/18/2016 05/18/2016 Windows Forms GridDataBoundGrid(Classic)
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.