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

How I can unselect all rows in RadGridView?

15 Answers 1795 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dmitry Shapiro
Top achievements
Rank 1
Dmitry Shapiro asked on 28 Oct 2008, 09:41 AM
When occur binding data in RadGridView first row selected. But I'm need unselect all rows.
I'm use latest version. (WinForms Q2 2008 SP1)

15 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 28 Oct 2008, 03:57 PM
Hello Dmitry Shapiro,

Thank you for contacting us. 

In the default theme, the first row is always selected after binding. Similarly, the selected rows are highlighted as well.

Yes, this could be a little confusing, because the first row is always selected. Could you give us more details on your scenario? These will help us in providing you a suitable solution for your case. We will also consider changing that in one of our future releases.

 
Greetings,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dmitry Shapiro
Top achievements
Rank 1
answered on 29 Oct 2008, 09:15 AM
Hello Nick.

RadGridView it is used for simple mapping of the data. When the user clicks with the mouse a table row - the data is displayed in other component in more details. If it is selected nothing - other component should be disable. When occurs databinding - in a component of detailed mapping it is empty, but in RadGridView selected the first row. It calls misunderstanding in users (.
0
Nick
Telerik team
answered on 30 Oct 2008, 08:04 PM
Hi Dmitry Shapiro,

Thank you for your feedback. I understand your concerns. Unfortunately, the current row (the first one at the beginning) is always visualized like the selected rows.
 

Sincerely yours,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Alex Lin
Top achievements
Rank 1
answered on 28 May 2009, 08:19 PM
Hi Telerik Support,

Has this issue been addressed?
I am trying to unselect the first row after a databinding, but I can't seem to do that still.

P.S. Is there a way to unselect the cell of the first row after databinding?

Thank you,
Alex
0
Nick
Telerik team
answered on 29 May 2009, 08:45 AM
Hello Alex Lin,

Thank you for contacting us. There was an update in our themes and currently most our themes visualize current row and selected row(s) differently. You can read further in our documentation. There is always one current row and even though it is visualized in a slightly different way than the selected ones, this can be confusing. Current row is used in keyboard navigation.

Greetings,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Prad
Top achievements
Rank 2
answered on 02 Jun 2009, 05:17 PM
I am not sure if you question is resolved.

Setting

radGridView1.CurrentRow =

null;

will help you unselect rows.

 

0
Nick
Telerik team
answered on 03 Jun 2009, 09:11 AM
Hello Pradeep,

Thank you, Pradeep, that should work. I have updated your Telerik points for sharing your knowledge with the community. I have updated the documentation about current and selected rows. The change will appear in a week.

Best wishes,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roger Andersson
Top achievements
Rank 1
answered on 17 Nov 2009, 09:07 AM
Using "2009 Q2" this 'CurrentRow = null' won't work.
The selected row is still selected thus selecting subitems that should be removed when the 'first' unselect is done.

I'll try again when we got Q3 installed
0
Jack
Telerik team
answered on 18 Nov 2009, 05:07 PM
Hi Roger Andersson,

Actually setting CurrentRow to null should work when MultiSelect is turned off. When using RadGridView in multi-row selection mode you should call the GridElement.Update method. This is an issue and we will address it in one of our upcoming releases. Please consider the sample below:

this.radGridView1.CurrentRow = null;
this.radGridView1.GridElement.Update(GridUINotifyAction.StateChanged);

 
Greetings,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Lauren
Top achievements
Rank 1
answered on 17 May 2010, 07:57 PM
Hi,

I just change my dlls to version 2010.1.430.1030, and i'm facing the same issue. The 1st row of all my grids are selected. This wasn;t happening with the previous dlls (2010.1.309.1030).
I'm using  myGrid.SelectedItems.Clear(); to unselect it, but i have a few grids in my page. Is there a better way to unselect the first row?
Is there a command to do it by default in the xaml file ?

The command myGrid.SelectedItems.Clear(); only works on the grids with a GridViewSelectColumn. It does not work to remove the highlight of the first row on my grid  with no such selectColumn.
How can i remove the highlight from the 1st row then ?
(i tried myGrid.selectedItem = null; and myGrid.currentItem = null; but it didn't work)

Thank you for your help.

Lauren
0
Maya
Telerik team
answered on 18 May 2010, 10:24 PM
Hello Lauren,

In order to remove the selection of the first row of your RadGridView for Silverlight and WPF, you need to use the Property of the Grid IsSynchronizedWithCurrentItem and set it to "false".

I hope that helps.

Kind regards,
Maya
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Lauren
Top achievements
Rank 1
answered on 18 May 2010, 10:50 PM
Thanks very much Maya !
I didn't know about this property.

Regards,
Lauren
0
Alon
Top achievements
Rank 1
answered on 26 Aug 2010, 02:27 PM
I am using version 2010.2.10.806. (Winforms Q2 2010 SP1)
According to the documentation (http://www.telerik.com/help/winforms/selected_rows_and_current_row.html)
to unselect all rows call:
mygrid.SelectedRows.Clear();
However, this code does not compile.
Is there any way to unselect all rows in a radgridview using version Winforms Q2 2010 SP1?
thanks
Alon
0
Emanuel Varga
Top achievements
Rank 1
answered on 27 Aug 2010, 07:14 AM
Hello Alon,

The documentation you are mentioning is not really "up to date", if you want to clear the selection for the grid, try calling:

this.radGridView1.ClearSelection();
this.radGridView1.CurrentRow = null;

This should work for now, although i really think that always selecting the first row when binding, or when adding rows dynamically to the grid is a very bad idea.

Best Regards,
Emanuel Varga
0
Jack
Telerik team
answered on 27 Aug 2010, 05:18 PM
Emanuel, thank you for your suggestion, it is correct. When binding RadGridView it synchronizes its CurrentRow property with the Position property of the currency manager. You can easily override this behavior.

Alon, as Emanuel said our documentation is not up to date. We will correct that and I added Telerik points to your account for this report. We always try to keep our API to be similar with the default WinForms controls. That is why we changed the SelectedRows collection and added ClearSelection method in our latest release.

Should you have any further questions, do not hesitate to ask.

Kind regards,
Jack
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Dmitry Shapiro
Top achievements
Rank 1
Answers by
Nick
Telerik team
Dmitry Shapiro
Top achievements
Rank 1
Alex Lin
Top achievements
Rank 1
Prad
Top achievements
Rank 2
Roger Andersson
Top achievements
Rank 1
Jack
Telerik team
Lauren
Top achievements
Rank 1
Maya
Telerik team
Alon
Top achievements
Rank 1
Emanuel Varga
Top achievements
Rank 1
Share this question
or