Tip #75: Did you know…How to maintain scrollposition after post back?

简介: When web pages are posted back to the server, by default user is returned to the top of the page. On a large web page, you might have a requirement t...

When web pages are posted back to the server, by default user is returned to the top of the page. On a large web page, you might have a requirement to scroll down the user automatically to the last position on the page.

MaintainScrollPositionOnPostBack page property can be used to achieve this  in one of the following ways. 

  1. Application level: To set the property by default for all pages in the website, open web.config and add the attribute to the pages node.

    <pages maintainScrollPositionOnPostBack="true">

  2. Page Level: for a particular page, open the aspx and set the property

    <%@ Page MaintainScrollPositionOnPostback="true" ...

  3. Code level: to set the property programmatically

    Page.MaintainScrollPositionOnPostBack = true;

Hope this helps.

Deepak Verma 

相关文章
|
6月前
|
Web App开发 前端开发
canvas保存图片时,谷歌浏览器Chrome报错【解决方案】Not allowed to navigate top frame to data URL
canvas保存图片时,谷歌浏览器Chrome报错【解决方案】Not allowed to navigate top frame to data URL
165 0
|
8月前
解决ERROR in Conflict: Multiple assets emit different content to the same filename index.html 的问题
解决ERROR in Conflict: Multiple assets emit different content to the same filename index.html 的问题
685 0
|
8月前
使用Form报错提示If ngModel is used within a form tag, either the name attribute must be set or the form
使用Form报错提示If ngModel is used within a form tag, either the name attribute must be set or the form
|
传感器 编译器 C#
VS_C#小tip
VS_C#小tip
63 0
|
应用服务中间件 Linux BI
Tomcat部署iframe出现Refused to display ‘url‘ in a frame because it set ‘X-Frame-Options‘ to ‘deny‘无法访问问题
Tomcat部署iframe出现Refused to display ‘url‘ in a frame because it set ‘X-Frame-Options‘ to ‘deny‘无法访问问题
813 0
Tomcat部署iframe出现Refused to display ‘url‘ in a frame because it set ‘X-Frame-Options‘ to ‘deny‘无法访问问题
|
应用服务中间件 nginx
|
Web App开发 安全
Not allowed to navigate top frame to data URL
Not allowed to navigate top frame to data URL
333 0