Parameter.SaveViewState Parameter.SaveViewState Parameter.SaveViewState Parameter.SaveViewState Method


儲存自頁面回傳至伺服器以來 Parameter 物件檢視狀態的變更。Saves the changes to the Parameter object's view state since the time the page was posted back to the server.

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


包含 Object 檢視狀態變更的 ParameterThe Object that contains the changes to the Parameter view state. 如果沒有與物件關聯的檢視狀態,則這個方法會傳回 nullIf there is no view state 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 life cycle.

儲存 view 狀態時,會將此字串物件傳回給用戶端,做為儲存在 HTML hidden專案中的變數。When view state is saved, this string object is returned to the client as a variable that is stored in an HTML hidden element. 當您撰寫自訂伺服器控制項時,您可以覆寫這個方法並修改伺服器控制項的ViewState屬性,藉此提升效率。When you author custom server controls, you can improve efficiency by overriding this method and modifying your server control's ViewState property.