C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Maintain ScrollBar position on postbacks in ASP.NET Page
WhatsApp
Ankit Nandekar
14y
11.2
k
0
0
25
Blog
After user clicks on postback controls, ASP.NET web page is reloaded in the browser and scroll position is set to the top of the page.
If your pages are high/long and controls that cause postback are placed on the bottom it can be really annoying for users to manually scroll down after every postback.
Fortunately, this can be easily solved using the
Page.MaintainScrollPositionOnPostBack
property like this:
<%
@
Page
Language
="C#"
AutoEventWireup
="true"
...
MaintainScrollPositionOnPostback
="true"
%>
After the postback and reload of the page, the previous scroll position will be restored.
NOTE:
This only works in .Net Framework 2.0 and higher!
Maintain ScrollBar position on postbacks in ASP.NET Page
People also reading
Membership not found