Monday, 26 March 2012

Return user in same position on page after postback event in asp.net ?


When Web pages are posted back to the server, the user is returned to the top of the page. 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.

<%@ Page Language="C#" AutoEventWireup="true" MaintainScrollPositionOnPostback="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

Note:
In ASP.NET version 2.0, the SmartNavigation property is deprecated. Use the SetFocus method and the MaintainScrollPositionOnPostback() property instead. i.e in the code behind use the set focus property of the control after the post back.

No comments:

Post a Comment