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

Grid does not auto scroll to row when selected

3 Answers 231 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 2
Bob asked on 14 May 2012, 09:26 PM

When I search for an item in a row, the grid does not scroll down to the selected row.

The row is selected, but I have to manually scroll down to the selected row.

I have AutoScroll = true

Thanks

If filterTextBox.Text <> "" Then
    For Each row As GridViewDataRowInfo In LotDetailsDataGrid.Rows
        If (filterTextBox.Text.Equals(row.Cells("ISBN_13").Value.ToString)) Then
            row.IsSelected = True
            Exit For
        End If
    Next
End If

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 17 May 2012, 01:49 PM
Hello Bob,

Thank you for writing.

The AutoScroll property comes from ScrollableControl and it is not intended for the desired functionality. More information about it can be found here: http://msdn.microsoft.com/en-us/library/system.windows.forms.scrollablecontrol.autoscroll.aspx.

To achieve the desired functionality you need to use the ScrollToRow method of the TableElement:
radGridView1.TableElement.ScrollToRow(radGridView1.Rows[30]);

I hope this helps. Let us know if you have any other questions.

All the best,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Bob
Top achievements
Rank 2
answered on 17 May 2012, 03:28 PM
Thank you!

That was exactly what I was looking for.

As a side note, when the grid scrolls to the specific row it is not highlighted.  So if anyone is wondering, I added:

radGridView1.Rows(row.index).IsSelected = True

and the row was nicely highlighted for me as well.

Thanks
0
Stefan
Telerik team
answered on 22 May 2012, 02:06 PM
That is correct. The method mentioned only scrolls the grid to the specified row. If you want the row to be selected you should set its IsSelected property. If you want it current, set the IsCurrent property.

All the best,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Bob
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Bob
Top achievements
Rank 2
Share this question
or