RadGrid for ASP .NET version
RadControls for ASP .NET AJAX version |
4.5.2 and later
2008.1.415 and later |
.NET version |
2.0 and later
|
Visual Studio version |
2005 and later
|
Programming language |
C#, Javascript
|
Browser support |
all supported by RadGrid for ASP .NET
all browsers supported by RadControls for ASP .NET AJAX
|
To convert code from posted projects |
Telerik online converter |
PROJECT DESCRIPTION
Some scenarios require leaving the page and when getting back to it the grid to be scrolled to the position where it has been before leaving the page. A cookie can be used to store the grid scroll position so it can be restored when entering the page again. r.a.d.
grid's client event
OnScroll can be used to save the current grid scroll position. The element to be scrolled when loading the page is grid's data div, that is the grid
ID, followed by
_GridData.
The javascript code used follows:
function SetScrollPosition() |
{ |
var y = document.getElementById('<%= RadGrid1.ClientID%>_GridData').scrollTop; |
document.cookie = "divPos=!^^->" + y + "<-^^!"; |
} |
window.onload = function() |
{ |
var cook = document.cookie; |
if(cook.indexOf("!^^->")!=0) |
{ |
var start = cook.indexOf("!^^->"); |
var end = cook.indexOf("<-^^!"); |
var pos = cook.substring(start+5, end); |
window.setTimeout(function() |
{ |
document.getElementById('<%= RadGrid1.ClientID%>_GridData').scrollTop = pos; |
}, 0); |
} |
} |