简体   繁体   English

想要移动页面以在更新面板中显示新闻项的顶部,或者如何在AJAX中的asyncPostback之后设置页面位置

[英]Want to move page to show top of the news item inside update panel or how to Set Page Position after asyncPostback in AJAX

I am using a paging control on one of the pages to display news, I display about 8 items of news at one time & use Ajax Update Panel for this page to refresh only the news area, Everything works fine. 我正在其中一个页面上使用分页控件来显示新闻,我一次显示大约8条新闻,并为此页面使用Ajax更新面板来仅刷新新闻区域,一切正常。 If you will visit the link you will find that if you click on the 2 page in the pager control it still remains at the bottom of the page [Example][1] 如果您将访问该链接,则会发现,如果您在寻呼机控件中单击第2页,它仍然保留在页面底部[示例] [1]

I somehow want the page to move back to top of the news items area otherwise if we have only 1 or 2 items on the second page then page looks empty & users have to use browser scroll to move up. 我想以某种方式将页面移回新闻项区域的顶部,否则,如果第二页上只有1或2个项目,则页面看起来为空,用户必须使用浏览器滚动才能上移。 I want pager to show the top 1st items of the news page on each page as they navigate. 我希望寻呼机在导航时在每个页面上显示新闻页面的前1个项目。 I cant do it in the code i am afraid. 我恐怕无法在代码中做到这一点。 Can i some how do it using jQuery so that when ever users navigate between pages it always moves page to the 1st news item on that particular page. 可我一些如何做到这一点使用jQuery这样,当用户过的页面之间导航总是把光标移动到页面的特定页面上的第一个新闻。 I hope you understand what i mean. 我希望你明白我的意思。

I need something like a bookmark so that it always moves page to 1st news item after asynchronous postback takes palce 我需要像书签这样的东西,以便在异步回发占用地方后,它总是将页面移至第一新闻

Link for Pager control that i am using. 我正在使用的Pager控件的链接 I would appreciate help in this regard. 在此方面的帮助,我将不胜感激。

Following code helped me to set scroll position after asyncpostback 以下代码帮助我在asyncpostback之后设置滚动位置

   <script type="text/javascript">
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        prm.add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            window.scroll(0,0);
       }
    </script>

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

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