Page.MaintainScrollPositionOnPostBack 屬性


取得或設定值,這個值表示是否要讓使用者在回傳後返回用戶端瀏覽器中的相同位置。Gets or sets a value indicating whether to return the user to the same position in the client browser after postback. 這個屬性會取代已過時的 SmartNavigation 屬性。This property replaces the obsolete SmartNavigation property.

 property bool MaintainScrollPositionOnPostBack { bool get(); void set(bool value); };
public bool MaintainScrollPositionOnPostBack { get; set; }
member this.MaintainScrollPositionOnPostBack : bool with get, set
Public Property MaintainScrollPositionOnPostBack As Boolean


如果應該維護用戶端位置,則為 true;否則為 falsetrue if the client position should be maintained; otherwise, false.



當網頁回傳至伺服器時,使用者會回到頁面的頂端。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.

當 [MaintainScrollPositionOnPostBack] 屬性設定為 [true] 時,使用者會改為回到頁面上的最後一個位置。When the MaintainScrollPositionOnPostBack property is set to true, the user is instead returned to the last position on the page.

您可以設定@ Page指示詞中的 MaintainScrollPositionOnPostBack 屬性。You set the MaintainScrollPositionOnPostBack property in the @ Page directive.