I'm confused as to when each comes into play and what their exact function is. I'm reading an article that claims that a TextBox's internal Text property would have this getter/setter method.

public string Text
{
    get { return (string)ViewState["Text"]; }
    set { ViewState["Text"] = value; }
}

The article goes on to say that "A very common conceptual error is the thought that Viewstate is responsible for preserving posted data. This is absolutely false; Viewstate has nothing to do with it."

Well, lets say I have a bunch of checkboxes which are added to the aspx page dynamically in C#. When a button is clicked in the browser, I want the state of the checkboxes in the browser to be saved (I want to remember the 'checked/unchecked' state across postbacks). Does ViewState do this or does Loadpostbackdata do this?

thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.