ViewState property - maintaining variable between page loads without hidden field or form controls

by ebarcza 7/22/2009 7:09:00 AM

Pretty darn simple actually:

protected string SortExp
    {
        get
        {
            if (ViewState["SortExp"] = null)
            {
                ViewState["SortExp"] = "PoolName";
            }
            return ViewState["SortExp"];
        }
        set
        {
            ViewState["SortExp"] = value;
        }
    }

I this case I am using this viewstate property to save the current sort direction of a gridview, Sorting will be covered in another post!

Tags:

.NET

Comments

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  January 2018  >>
MoTuWeThFrSaSu
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2018

Sign in