ASP.net中PostBack后如何保持垂直位置

来源:互联网 发布:备案域名买卖交易平台 编辑:程序博客网 时间:2024/05/22 01:48

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. 

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">
Page Level: for a particular page, open the aspx and set the property

<%@ Page MaintainScrollPositionOnPostback="true" ...
Code level: to set the property programmatically

Page.MaintainScrollPositionOnPostBack = true;
Hope this helps.

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/Python/archive/2009/06/17/4275953.aspx

原创粉丝点击