Scrolling in non-IE browsers.

M

Marc Jennings

When editing a DataGrid that is about halfway down a scrollable page,
ideally, when the edit link is clicked I would like to be taken to the
control that I am editing. With Internet Explorer this works fine
through using the smartNavigation="true" attribute within the
web.config file.

However, this seems to be an 'Internet Explorer Only' Feature. I
wondered if there was any way of imitating this behaviour to suit and
operate fine when using Mozilla based browsers.

Any help and guidance greatly appreciated.
 
S

Steven Cheng[MSFT]

Hi Marc,

Thanks for your posting. As for the keeping scroll postion between
multi-postback problem. In addition to using the smartNavigation, we can do
this via manually register some client script to track the scroll postion
and maintain it at clientside. And the most important point is that we need
to use the browser's
window.onscroll event. However, this event has browser compatiblity issue,
below is a list of the event compatiblity table, seems mozilla only support
it over 1.7 version.

#Event compatibility tables
http://www.quirksmode.org/js/events_compinfo.html

As for those browsers which support this event , we can just use a hidden
field to record the current scroll postion when scroll postion changes at
clientside and after page post back, reset the scroll postion in onload
clientside event. for example:

=====================================
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">

function body_initscroll()
{
window.onscroll = body_recordscroll;
document.body.scrollTop = document.getElementById("vpos").value;
}


function body_recordscroll()
{
document.getElementById("vpos").value = document.body.scrollTop;
}
</script>
</HEAD>
<body onload="body_initscroll()">

..........................
=====================================

Hope helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top