共用方式為


Supporting Application View State 

Application view state for ASP.NET mobile controls functions the same way that it does for ASP.NET server controls in the .NET Framework. Use the following guidelines when supporting application view state in your code:

  • All controls have a property named ViewState that automatically manages state information. Any user-defined properties that you can save as part of a view state can be saved in this property.

  • After a page is initialized from persistent settings, view-state tracking begins. Write any changes that are made after this point as part of a view state. The ViewState property automatically manages these changes.

  • For more complex view state behavior, you must write your controls to override the TrackViewState, LoadViewState, and SaveViewState methods, and provide the appropriate logic.

  • Complex objects that can handle their own view state management, such as items in a list, can implement the IStateManager interface, which exposes the members required to manage application view state.

See Also

Other Resources

Supporting View State