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

Selecting a gridview row not in current view

5 Answers 450 Views
GridView
This is a migrated thread and some comments may be shown as answers.
maydaytx
Top achievements
Rank 1
maydaytx asked on 15 Aug 2007, 08:19 PM
When I set the CurrentRow on a row that is visible, the row is selected correctly.  However, when I set the CurrentRow on the Grid and it is not visible in the current scroll area of the Grid, it doesn't scroll to the CurrentRow.  And when you click the scrollbar, it automatically scrolls, but the wrong row is selected (the index always seems to be +1).

Example:

grdAwesome.MasterGridViewInfo.CurrentRow = grdAwesome.Rows[3];

works as expected, but

grdAwesome.MasterGridViewInfo.CurrentRow = grdAwesome.Rows[69];

doesn't work, as detailed above.

~DuckLeg
 |
 |
/|\

5 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 16 Aug 2007, 01:38 PM
Hi maydaytx,

This issue will be fixed in the next service pack. You can use ScrollToRow function to make visible a specified row:

this.radGridView1.GridElement.ScrollToRow(69);

     
Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
fgalarraga
Top achievements
Rank 1
answered on 05 Sep 2007, 03:11 PM

This does not seem to work? I am trying to use it as a work around for the CurrentRow issue.
 
If gvResults.MasterGridViewInfo.Rows.Count > 0 Then
    gvResults.GridElement.ScrollToRow(0)
End If

gvResults.Focus()

The focus is not set on the row and it is not highlighted on the grid.  Any ideas?

Thank you,
Frank 

0
Jack
Telerik team
answered on 06 Sep 2007, 08:18 AM
Hi fgalarraga,

CurrentRow sets the current focused row in grid but does not scroll to this row if it is not visible. ScrollToRow just scrolls to the chosen position, but does not select the row. So, to achieve this effect use a combination between a call to CurrentRow setter and ScrollToRow function. See this code:

If gvResults.MasterGridViewInfo.Rows.Count > 0 Then
    gvResults.CurrentRow = gvResults.Rows(0)
    gvResults.GridElement.ScrollToRow(0) 
End If


 
Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Venkata
Top achievements
Rank 1
answered on 01 Feb 2011, 07:54 PM
How to use gridView.SelectedRow using Telerik GridView?
0
Jack
Telerik team
answered on 04 Feb 2011, 05:02 PM
Hi fgalarraga,

Thank you for contacting us. I am not sure that I understand your question. Could you please describe in greater detail what exactly you want to achieve?

RadGridView exposes a property named CurrentRow which points to the currently active row which contains the focus. This property is synchronized with the Position property of the currency manager. The SelectedRows property contains all selected rows when RadGridView is in multiple row selection mode: The MultiSelect property is set to true and the SelectionMode property is set to FullRowSelect. Please check this help article and the GridView >> Rows >> Selection example in our demo application for more information.

Should you have any other questions, I will be glad to help.

Kind regards,
Jack
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
maydaytx
Top achievements
Rank 1
Answers by
Jack
Telerik team
fgalarraga
Top achievements
Rank 1
Venkata
Top achievements
Rank 1
Share this question
or