
I can't find any reference to FirstDisplayedScrollingRowIndex for the radgridview as it exists in datagridview. Did i missed it, or is there another way to obtain this property in a radgridview ?
Best Regards,
Guillaume.
Adiial
7 Answers, 1 is accepted
Yes, there is no such method in RadGridView. However, you can use the following code to get the index:
public
int
GetFirstDisplayedScrollingRowIndex(RadGridView grid)
{
foreach
(GridRowElement row
in
grid.GridElement.VisualRows)
{
GridViewDataRowInfo dataRowInfo = row.RowInfo
as
GridViewDataRowInfo;
if
(dataRowInfo !=
null
)
{
return
grid.Rows.IndexOf(dataRowInfo);
}
}
return
-1;
}
I hope this helps.
Sincerely yours,
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.


Dear
the property FirstDisplayedScrollingRowIndex is not shown in telerik, how to set a row in the datagrid to be displayed at the top of the grid, not using the pinposition property.
The problem is that when the user is adding a lot of rows (the adding rows is on the bottom), the user must use the scroll bar of a grid to go down , and it's a little bit difficult.
using the usual gridview :
dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.SelectedRows[0].Index;
how to use it in telerik ?

Dear
the property FirstDisplayedScrollingRowIndex is not shown in telerik, how to set a row in the datagrid to be displayed at the top of the grid, not using the pinposition property.
The problem is that when the user is adding a lot of rows (the adding rows is on the bottom), the user must use the scroll bar of a grid to go down , and it's a little bit difficult.
using the usual gridview :
dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.SelectedRows[0].Index;
how to use it in telerik ?
Thank you for writing.
You can easily scroll to the last added row by calling its EnsureVisible. A suitable place is the handler of the UserAddedRow event:
private
void
radGridView1_UserAddedRow(
object
sender, Telerik.WinControls.UI.GridViewRowEventArgs e)
{
e.Row.EnsureVisible();
}
If you want the row to be added an index 0, depending on whether you are data bound or not you have two options:
- In unbound mode you can simply reorder the Rows collection:
//Unbound mode
private
void
radGridView1_UserAddedRow(
object
sender, GridViewRowEventArgs e)
{
this
.radGridView1.Rows.Move(e.Row.Index, 0);
}
- If the grid is data bound you would need to reorder the items within your data source, if it allows it. The example below handles a scenario when you have a bound DataTable:
//Bound mode
private
void
radGridView1_UserAddedRow(
object
sender, GridViewRowEventArgs e)
{
DataTable dtable = (DataTable)
this
.radGridView1.DataSource;
DataRow dr = dtable.Rows[dtable.Rows.Count - 1];
DataRow newRow = dtable.NewRow();
newRow.ItemArray = dr.ItemArray;
dtable.Rows.Remove(dr);
dtable.Rows.InsertAt(newRow, 0);
}
Regards,
Hristo Merdjanov
Telerik by Progress

Dear
Kindly check the attached photos.
Photo1.png shows that there's no place and free enough space to add new row. The user must go to scroll with the mouse each time to add 1 row.
there's a way to add big empty white space (maybe, to resize the heigh of the grid . . . ) to looks as the photo 2.
it's easier for the user to add new rows
Thank you for writing back.
You can achieve the desired result by pinning the new row to the bottom. Please see below:
this
.radGridView1.MasterView.TableAddNewRow.PinPosition = Telerik.WinControls.UI.PinnedRowPosition.Bottom;
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
Telerik by Progress