SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software Kodyaz Development Resources
Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.

.NET Framework, ASP.NET

ASP.NET, Windows Forms, Controls, .NET Framework and Visual Studio Articles

ASP.NET Forums

Visual Studio Forums

.NET Development Blog

Certification Exams Blog

Maintain your scroll position on ASP.NET web pages with MaintainScrollPositionOnPostback

In ASP.NET pages by adding the MaintainScrollPositionOnPostback property as "true" to the Page tag, you can easily let your users keep their scroll positions on postbacks. By this property users can return to the same position in their client browsers after the postbacks of web pages. If you do not set this property to true, it is set to false by default and users will suffer especially in long web pages to scroll down on the page to return back to where they were previously.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" MaintainScrollPositionOnPostback="true" %>

You see, the MaintainScrollPositionOnPostback is a boolean property which can be "true" or "false"

MaintainScrollPositionOnPostback is a replacement of the SmartNavigation property which is obsolete now.

Setting this property to true the following hidden form fields are added to web page with values indicating the scroll positions.

<input type="hidden" name="__SCROLLPOSITIONX" id="__SCROLLPOSITIONX" value="0" />
<input type="hidden" name="__SCROLLPOSITIONY" id="__SCROLLPOSITIONY" value="1916" />

Copyright © 2004 - 2020 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems