TextBox.SaveViewState TextBox.SaveViewState TextBox.SaveViewState TextBox.SaveViewState Method

定義

儲存自頁面回傳至伺服器以來文字方塊檢視狀態的變更。Saves the changes to the text box view state 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

傳回

包含 Object 檢視狀態變更的 TextBoxThe Object that contains the changes to the TextBox view state. 如果沒有與物件相關聯的檢視狀態,則這個方法會傳回 nullIf no view state is associated with the object, this method returns null.

備註

這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

「檢視狀態」是伺服器控制項屬性值的累積。View state is the accumulation of the values of a server control's properties. 這些值會自動放在伺服器控制項的ViewState屬性中,這是StateBag類別的實例。These values are automatically placed 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's life cycle. 如需詳細資訊,請參閱IIS 5.0 和6.0 的 ASP.NET 應用程式生命週期總覽For more information, see ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0.

儲存 view 狀態時,此字串物件會以變數的形式傳回給用戶端,並儲存在隱藏的 HTML 輸入元素中。When view state is saved, this string object is returned to the client as a variable that is stored in a hidden HTML input element. 當您撰寫自訂伺服器控制項時,您可以覆寫這個方法並修改伺服器控制項的ViewState屬性,藉此提升效率。When you author custom server controls, you can improve efficiency by overriding this method and modifying your server control's ViewState property. 如需詳細資訊,請參閱ASP.NET 狀態管理總覽For more information, see ASP.NET State Management Overview.

適用於

另請參閱