简体   繁体   English

如何维护包含usercntrols的aspx页面的滚动位置

[英]How to maintain scroll position of the aspx page which contains usercntrols

i have to maintain scroll position of a page which contains Usercontrols and some buttons in it. 我必须保持页面的滚动位置,其中包含用户控件和一些按钮。

when controls in usercontrols are clicked the page is post-backed. 当单击用户控件中的控件时,页面将被后退。 i want to maintain the page scroll position where it is before. 我想保持页面滚动位置在以前。

I have tried Maintainscrollposition= true like this things in my pages. 我在我的页面中尝试过诸如此类的方法来维护Maintenancescrollposition = true。

please suggest me with some examples. 请给我一些例子。

thanks in advance. 提前致谢。

make sure you have Maintainscrollposition= true in the page where you use the usercontrol. 请确保您在使用用户控件的页面上具有Maintenancescrollposition = true。 (i suppose you already tried to put it in the usercontrol header) (我想您已经尝试将其放在usercontrol标头中)

if that doesnt work then in page_load, add Page.MaintainScrollPositionOnPostBack = true; 如果不起作用,则在page_load中添加Page.MaintainScrollPositionOnPostBack = true;

if it still doesnt work then let me know and i will try and find a javascript code i used in the past.. 如果仍然无法使用,请告诉我,我将尝试找到我过去使用的JavaScript代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM