This sample demonstrates the basics of PostBacks and control state preservation. Notice that all of this code runs against a single page that 'posts back' to itself and works by continually updating its page display state. The click of either button causes a click event to be fired in server page code. The page re-runs through a full postback but the button click handler is invoked and can modify the page accordingly.
Notice that when you click on a button the data in the textboxes always persists. No code is required to re-populate the text as is usually necessary in Web pages as the Web Control framework automatically applies any posted content back to the originating controls.
However, notice that the message label and the color options will not persist across button clicks. If you click Say Hello and a color is set on the button, the color is lost. If you click on Set Color and a message is set, the message is lost. This is because labels and captions - just about any attribute of controls are not posted back to the server, so these values are not automatically persisted back.
You can however, explicitly force any properties to be maintained by the server by calling the PreserveProperty() method on any control. When you click the Preserve Properties checkbox on the form the Hello World Label caption and color and the button color are persisted between page hits.