RadGridView - Avoid CurrentCell auto selection

2 Answers 46 Views
GridView
Álvaro
Top achievements
Rank 1
Iron
Iron
Álvaro asked on 12 Jan 2024, 10:21 AM

Hi,

I would like to have a grid with no cell selected by default. So every time it is loaded no CurrentCell is selected. Same when there is no selection and the grid is sorted by a column.

Right now, the grid marks the first cell as CurrentCell when it is loaded. I could solve it using the .ClearSelection() method but then I have the same problem when sorting: the first cell is marked as selected.

How can avoid this behavior and only set the CurrentCell when the user marks it?

2 Answers, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 12 Jan 2024, 02:29 PM

Hello, Álvaro,

You can set CurrentRow property to null:

 this.radGridView1.CurrentRow = null;

I hope this helps. Please let me know if you have any other questions.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Álvaro
Top achievements
Rank 1
Iron
Iron
commented on 12 Jan 2024, 06:27 PM

Hi Nadya!

It would not work in all cases since I want to keep the CurrentCell when the user selects a cell. So once selected, I want it after sorting or filtering.

My problem is that the grid selects the first cell by default.

0
Nadya | Tech Support Engineer
Telerik team
answered on 15 Jan 2024, 12:32 PM

Hello, Álvaro,

Setting the CurrentRow initially will not show the first cell/row as selected when the grid is loaded. This means that the grid would not select the first cell by default.  However, you will be able to select any cell you want later after sorting/filtering, etc. 

Another possible solution that I can suggest is to set IsCurrent property to false:

radGridView1.Rows[0].IsCurrent = false;

I hope this helps. Please let me know if I can assist you further. 

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Álvaro
Top achievements
Rank 1
Iron
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or