• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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