How to maintain scroll position on autopostback?

前端 未结 12 1696
臣服心动
臣服心动 2020-12-30 21:49

How can I get back to the same position of a page on postback. It always seems to get to the top of the page.

I\'ve tried using maintainSc

12条回答
  •  自闭症患者
    2020-12-30 22:23

    There are a few ways I have used to set maintainScrollPositionOnPostBack. Have you tried more than one? Can you describe what is triggering the postback and which browsers you have tested? Are you using a master page?

    1. You can set Page.MaintainScrollPositionOnPostBack = true; in the code behind on page load.
    2. You can add it to the page declaration <%@ Page MaintainScrollPositionOnPostback="true" %>
    3. You can add it in the web config file

提交回复
热议问题