How can set scroll position after PostBack in asp net?
How can set scroll position after PostBack in asp net?
- You can set Page. MaintainScrollPositionOnPostBack = true; in the code behind on page load.
- You can add it to the page declaration <%@ Page MaintainScrollPositionOnPostback=”true” %>
- You can add it in the web config file
How can we maintain page position after PostBack in asp net?
Maintain scroll position after postbacks in ASP.NET 2.0
- use Web.config page section
- in the page declaration <%@ Page MaintainScrollPositionOnPostback=”true” %> : this will maintains the scroll position for this page only.
How to keep scroll position in asp net?
In asp.net, there are different ways to retain scroll position on postback. After Postback vertical scrollbar leave its position and access the same position on the page so to resolve this problem asp.net gives a property: âMaintainScrollPositionOnPostBackâ which maintains the scrollbar position on the webpage. Page.
What is MaintainScrollPositionOnPostBack true?
On long Web pages, this means that the user has to scroll the page back to the last position on the page. When the MaintainScrollPositionOnPostBack property is set to true , the user is instead returned to the last position on the page. You set the MaintainScrollPositionOnPostBack property in the @ Page directive.
How do I maintain scroll position in MVC?
On a new page you just have to load the saved position and make the view scroll there in 0 milliseconds (with Mootools or any Ajax script this should be possible) and the user will be exactly where they were.
How do I know my scroll position react?
To get scroll position with React, we can add a scroll listener to window . to create the scrollPosition state with the useState hook. Then we add the handleScroll function that takes the scroll position with the window.