Keep page position on postback

前端 未结 2 446
梦毁少年i
梦毁少年i 2020-12-30 10:15

Hi guys are working on this project for school and have a problem

    

        
相关标签:
2条回答
  • 2020-12-30 10:19

    You can set the MaintainScrollPositionOnPostback property on your page:

    Page.MaintainScrollPositionOnPostback = true;
    

    or put it in the page declaration

    <%@ Page MaintainScrollPositionOnPostback="true" %> 
    
    0 讨论(0)
  • 2020-12-30 10:33

    I'm not entirely sure I what you are asking for. Facebook uses a lot of ajax style callbacks which means that the page doesn't reload using asp .net style postbacks. If you're just starting out I'd recommend you trying placing your code into an Ajax .Net UpdatePanel whilst you learn the details of Ajax / JSON / XMLHttpRequest etc.

    If you're simply looking to make sure the browser window remains at the same scrollbar position after a postback then set the page to use the MaintainScrollPositionOnPostback="true" directive.

    0 讨论(0)
提交回复
热议问题