Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A sample project showing how to access ViewState data dynamically by using DynamicObject class
branch: master

changed to markdown readme.

--HG--
rename : README => README.markdown
latest commit 6970f08787
Giorgi authored
Failed to load latest commit information.
DynamicViewStateDemoWebApplication Moved BasePage to ViewState project so that you only need to inherit …
ViewStateEx
.gitignore Initial Commit
.hgignore Initial Commit
DynamicViewStateDemoWebApplication.sln Moved implementation to separate project.
README.markdown changed to markdown readme.

README.markdown

A sample project showing how to access ViewState data dynamically by using DynamicObject class in the same manner as ViewBag in ASP.NET MVC 3

public partial class SamplePage : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            ViewState.loadCount++;

            loadLabel.Text = string.Format("Load count: {0}", ViewState.loadCount);
        }
        else
        {
            ViewState["loadCount"] = 0;
            loadLabel.Text = "Load count: 0";
        }
    }
}

Related blog posts: http://www.aboutmycode.com/asp-net/dynamic-viewstate-in-asp-net-webforms/ http://www.aboutmycode.com/asp-net/dynamic-viewstate-in-asp-net-webforms-part-2/

Something went wrong with that request. Please try again.