This page is a draft and may contain incorrect information and/or experimental styling.

Create property that saves to ViewState

Table of Contents


The following illustrates how to create a property that saves data to the ViewState on a web page.
private string FunctionalCurrency
{
   get
   {
      string keyName = System.Reflection.MethodBase.GetCurrentMethod().Name.Substring(4);
      string rv = this.ViewState[keyName].SafeStringAssign();

      return rv;
   }
   set
   {
      string keyName = System.Reflection.MethodBase.GetCurrentMethod().Name.Substring(4);
      this.ViewState[keyName] = value;
   }
}


Last modified by Mohit @ 4/11/2025 7:43:49 AM