Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
141
Scroll last row into view
posted

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();

 }

}