The following javascript scrolls the last row into veiw of a datagrid (I tested it by simply creating a html input button and attaching this function to the onclick attribute. So it works.) I am adding rows to the underlying dataset of webgrid and posting back to a server and updating the database each time (this is a requirement of the business process being implemented). After the post back, I would like to to run this javascript without user intervention. Can anyone help in this regard.
function Scroll() {
var grid = igtbl_getGridById('dgPhotoOrder');
if (grid.Rows.length > 9) {
grid.Rows.getRow(grid.Rows.length - 1).setSelected(true);
grid.Rows.getRow(grid.Rows.length - 1).scrollToView();
}
Hi,
After a postback the grid's first event that fires on the client is the InitializeLayout event. You can use this event to get access to the Grid's rows.
Magued