Logo

ASP.NET Samples

Incrementor

Please click the button a few times.

This ASP.NET example demonstrates ViewState using a Web server control, <asp:Button>. After clicking the button serveral times, try clicking the back button on your Web browser several times. Without ASP.NET, clicking the back button would change pages back to the page this one was linked from. Because we are using ASP.NET, each button click is like creating another page on the fly with the dynamic counter incrementor unique value on each page. The state of the form button is saved dynamically after each click.

Please see Understanding ASP.NET View State for more info on ViewState. Please see Server Controls for more information on server controls, like Web server controls.

« ASP.NET Samples Home