DataPager.SaveViewState DataPager.SaveViewState DataPager.SaveViewState DataPager.SaveViewState Method

定義

儲存對 DataPager 控制項的檢視狀態所做的任何變更,這些變更是網頁被回傳到伺服器時所發生。Saves any changes to an DataPager control's view-state that have occurred since the time the page was posted back to the server.

protected:
 override System::Object ^ SaveViewState();
protected override object SaveViewState ();
override this.SaveViewState : unit -> obj
Protected Overrides Function SaveViewState () As Object

傳回

傳回 DataPager 控制項的目前檢視狀態。Returns the DataPager control's current view state. 如果沒有與控制項相關聯的檢視狀態,則這個方法會傳回 nullIf there is no view state associated with the control, this method returns null.

備註

「檢視狀態」是伺服器控制項屬性值的累積。View state is the accumulation of the values of a server control's properties. 這些值會自動放在伺服器控制項的ViewState屬性中, 這是StateBag類別的實例。These values are automatically put in the server control's ViewState property, which is an instance of the StateBag class. 這個屬性的值接著會在伺服器控制項生命週期的儲存狀態階段之後保存到字串物件中。This property's value is then persisted to a string object after the save-state stage of the server control life cycle. 如需詳細資訊, 請參閱ASP.NET 狀態管理總覽For more information, see ASP.NET State Management Overview.

儲存 view 狀態時, 會將此字串物件當做儲存在頁面隱藏專案中的變數傳送至瀏覽器。When view state is saved, this string object is sent to the browser as a variable that is stored in a hidden element in the page. 當您建立自訂伺服器控制項時, 您可以藉由覆寫這個方法並修改伺服器控制項ViewState的屬性, 來提升效率。When you create custom server controls, you can improve efficiency by overriding this method and modifying the server control's ViewState property. 如需詳細資訊, 請參閱ASP.NET 狀態管理總覽For more information, see ASP.NET State Management Overview.

注意

這個方法主要是由控制項開發人員用來擴充DataPager控制項。This method is primarily used by control developers to extend the DataPager control.

適用於

另請參閱