你的问题似乎与我最近的问题相似。 我倾向于说,邮政局是你的问题,你必须用贾瓦文处理雕像。 我的解决办法如下:
Create a HiddenField in the ASPX page to hold the current position of the ScrollBar.
< asp : HiddenField ID ="hdnScollTop" EnableViewState =true runat="server" />
• 建立 Java台功能,以节约和装上黑色地带的价值。 我还有一个更新名单的功能,我不得不用于我的多语言名单Box。
function Updatelist() {
//details removed
}
function GetListBoxScrollPosition(){
var sel = document.getElementById( <%=lstbxStuff.ClientID%> );
var hdnScrollTop = document.getElementById( <%=hdnScollTop.ClientID %> );
hdnScrollTop.innerText=sel.scrollTop;
}
function SetListBoxScrollPosition(){
var sel = document.getElementById( <%=lstbxStuff.ClientID%> );
var hdnScrollTop = document.getElementById( <%=hdnScollTop.ClientID %> );
sel.scrollTop=hdnScrollTop.value; //not sure why it s in value when I clearly put it in innerText. This is what works.
}
In Form_Load, register the JavaScript functions, and initialize the HiddenField Value.
In the code-behind s Page_Load I set all of the scripts.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindACLs();
//I use the hidden field to set the lstbxStuff
//scroll bar, which will scroll to the top anyway.
//This is to avoid a JavaScript error.
hdnScollTop.Value = "0";
}
else
{
lstbxStuff.Focus();
}
lstbxACLs.Attributes.Add("onclick", "GetListBoxScrollPosition();Updatelist();");
lstbxACLs.Attributes.Add("onfocus", "SetListBoxScrollPosition();");
}