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

Setting Selected Row - Two Rows Show Selected?

2 Answers 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Patrick Barranis
Top achievements
Rank 1
Patrick Barranis asked on 14 Jun 2010, 05:32 PM
Hi.  I have a strange problem.  I'm using a Telerik RadGridView on a RadForm.  During form Load I populate the control.  Then during form Show I try to set which row is selected (i.e. it's not the first row).

What I see afterwards is that the first row in the grid is Selected, but the row I wanted selected is "sort of" selected.  It's highlighted but not with the same dark/bold colors that the selected row is.  I've attached a screenshot just to make it more clear.

Here's my code to perform the selection.
        dgv.ClearSelection() 
        For Each row In dgv.Rows 
            If row.DataBoundItem.Equals(rowObject) Then 
                row.IsSelected = True 
                Exit For 
            End If 
        Next 
 

Can you help tell me what I'm doing wrong?  TIA!

(All code is .NET 3.5, Windows 7 x64, VS 2008.  I'm using the 2010 Q1 SP2 build / 2010.1.10.0504.)

2 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 17 Jun 2010, 03:56 PM
Hello Patrick Barranis,

Thank you for contacting us.

The IsSelected property is used to mark the row as selected when using RadGridView in multiple rows selection mode. In single selection it is better to use the IsCurrent property.

Should you have any other questions, don't hesitate to ask.

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.
0
Patrick Barranis
Top achievements
Rank 1
answered on 17 Jun 2010, 04:18 PM
Outstanding; thank you.

Not very intuitive, but thanks nonetheless :)
Tags
GridView
Asked by
Patrick Barranis
Top achievements
Rank 1
Answers by
Jack
Telerik team
Patrick Barranis
Top achievements
Rank 1
Share this question
or