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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to deselect the rows in the grid programmatically?

Platform: WinForms |
Control: GridDataBoundGrid(Classic) |
Published Date: May 18, 2016 |
Last Revised Date: May 18, 2016
Tags: selection

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

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon