prevent page from scroll up in asp.net link button

依然范特西╮ 提交于 2019-12-13 05:35:15

问题


how can I prevent page from scroll up after user click link button I have update panale warp my form I try to user on OnClientClick="return false" but no use even I try this Javascript function

window.scrollTo = function (x, y) {
        return true;
    }

回答1:


You can try .Focus() server-side method. E.g. if your LinkButton is called LinkButton1, add this to your Linkbutton's Click event handler:

LinkButton1.Focus();



回答2:


Try setting the MaintainScrollPositionOnPostBack property to false (MSDN reference). If that doesn't work, take a look at this script for maintaining scroll position for async postbacks.



来源:https://stackoverflow.com/questions/18344625/prevent-page-from-scroll-up-in-asp-net-link-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!