you have to check if the session is null first, if it is not, then assign to
strusename
. The session is an Object and thus, you will need to convert it to string also.
In C#
protected string ApplicationReviewStatus
{
get => ViewState["ApplicationReviewStatus"]?.ToString() ?? string.empty;
set => ViewState["ApplicationReviewStatus"] = value;
}
Also, you do this in the page's code behind file. In C# it is this extension (.aspx.cs). Implementing this (or passing it to a separate class file) is a simple as passing it to the class via a method parameter or class property, etc.