Hello,
In the code behind, I select the last row in the grid.
var selectedRows = this.webDataGrid.Behaviors.Selection.SelectedRows;selectedRows.Add(this.webDataGrid.Rows[rowIndex]);
The row is selected but I don't see it because of the scroll pane.
How to automatically scroll to the selected row?
Thanks.
Hi,
I am facing similar problem, if I use the scrollToView() method the scrollbar is not moving to the selected row. Please let me know whether I need to upgrade the IG version to 13
At present I am using Infragistics web controls v12.2[.20122.2257]
I am using your suggested method but it does not seem to work. I have added a new row. After that, I would like to select the newly added row and set the scrollbar to let users to see the selected row. What would be the possible reason that this does not work?
I had Activation behavior enabled.
Code behind:
protected void GridView1_OnRowAdded(object sender, RowAddedEventArgs e)
{ GridView1.ClearDataSource(); GridView1.DataSourceID = "ModelsDS"; GridView1.DataBind(); GridView1.Behaviors.Selection.SelectedRows.Clear(); GridView1.Behaviors.Selection.SelectedRows.Add(GridView1.Rows[GridView1.Rows.Count - 1]); }
Client side:
function GridView1_Initialize(sender, eventArgs) { try { var selectedRow = sender.get_behaviors().get_selection().get_selectedRows().getItem(0); selectedRow.get_cell(0).scrollToView(); } catch (e) { alert("Javascript error: GridView1_Initialize:\t" + e.message); } }
Hello schartrand ,
I’m just following up to see if you’ve been able to resolve your issue. If you have any questions or concerns or if you need further assistance please let me know.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Thank you for posting in our forum.
There’s no way to set the scroll position on the server side but you could handle the client side Initialize event and in it get the selected row. Then you could scroll that row into view using the cell’s
scrollToView method. For example:
function WebDataGrid1_Grid_Initialize(sender, eventArgs)
{
var row = sender.get_behaviors().get_selection().get_selectedRows().getItem(0);
row.get_cell(0).scrollToView();
}
Let me know if you have any questions or concerns.