Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

ViewState Code

I have the following code in an aspx page and I'm not sure what it's doing.

if (ViewState["COOLEnabled"].ToString().ToUpper() == "YES")
        {
            ddlSFCOOL.Enabled = bEnabled;
        }
        else
        {
            ddlSFCOOL.Enabled = false;
        }
            

any help will be appreciated.

Tim
0
TimSweet220
Asked:
TimSweet220
1 Solution
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Hello, somewhere your page must be setting that viewstate value:
ViewState["COOLEnabled"] = "yes";

Open in new window


Then in another place of your page that code (your example) check for that value to decide enable/disable your ddlSFCOOL control.

The ViewState object is like your Session object, but it values dont reside in the server, instead these values are saved in your page, this mean that they dont expires when your session does.
0
 
TimSweet220Author Commented:
Thanks.  I have a follow up question that I'll create a new question for.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now