PageViewsCount Example Using ViewState:
Introduction:
In my previous articles i explained various concepts on WPF,Asp.Net and Ajax.Now i will explain pageviewscount example using ViewState in Asp.Net. You can find full details regarding ViewState here.
Description:
ViewState:
It is the process of tracking the values of the controls on the page for multiple requests for the same page.
In this example we will calculate total postback count on that page. For this take two labels and a button on the page. Page looks like below
In the form load event write like this
For every button click event postback occurs and then displays the postback count in the label.
In the form load event write like this
For every button click event postback occurs and then displays the postback count in the label.
![]() |
ViewState Postback count example |
Conclusion:
I hope you got an idea on how read and write values to and from viewstate in asp.net.
Related Tutorials
- Architecture of WPF.
- Creation of Three Tier Architecture in .Net Application.
- Difference between App.config and Web.Config
- Asp.Net Validation Controls Tutorial
- Asp.Net Ajax Tutorials
- Difference between Machine.Config and Web.Config in Asp.Net Framework.
- Basic Drawings and Shapes in WPF.
- How to read and write key values from and to App.config Settings file .Net Windows Application.
- How to Use RangeValidator Control in Asp.Net with Example.
- Asp.Net Ajax Server Controls, Ajax Control Toolkit Download and Installation Tutorial.
- How to Use ViewState in Asp.Net(State Management Techniques).
- How to use Hidden Field in Asp.Net with Example(State Managemet Techniques).
- Beginners Tutorial on How to use QueryStrings in Asp.Net(State Management Techniques).
- Asp.Net Cookie Usage Overview with example(State Management Techniques).
- Access Specifiers or Modifiers in C# with example(Oops Concept).
Nice post very helpful
ReplyDeletedbakings