Here is my htc file in the same directory as the web form
// DHTML behavior for scrollable DIV
// (or other scrollable element)
//
// allows element to maintain scroll position within
// the DIV across postbacks.
It just seems to get ignored and the datagrid loses its scroll position
after each postback, any idea whats going on???
Thanx in advance
Robert
Re: inheriting behavior file
am 13.04.2008 21:12:34 von Anthony Jones
"Robert Smith" wrote in message
news:DB0C855E-85C2-4A6B-9287-FDC4182B8AF5@microsoft.com...
> Hi,
> I have a behavior file called ScrollPos.htc, which is supposed to
> maintain the scroll position of a datagrid within a div tag.
>
> In my html I have
>
> <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
> Inherits="MaintainScrollDemo" %>
>
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
>
> MaintainScrollDemo
>
>
>
>
> content="http://schemas.microsoft.com/intellisense/ie5"/>
>
>
>
>
>
>
>
>
> Here is my htc file in the same directory as the web form
>
>
>
>
>
> // DHTML behavior for scrollable DIV
> // (or other scrollable element)
> //
> // allows element to maintain scroll position within
> // the DIV across postbacks.
>
>
>
>
> It just seems to get ignored and the datagrid loses its scroll position
> after each postback, any idea whats going on???
>
HTCs are arcane, ancient and very IE-centric. I wouldn't avoid them.
Use something like this (warning untested):-
//ScrollPos.js
function ScrollPos(elem)
{
var saveId = elem.getAttribute("saveScrollID")
var scrollTop = document.getElement(saveID).value
elem.scrollTop = scrollTop
elem.onscroll = function()
{
document.getElement(saveID).value = this.scrollTop
}
elem = null;
}