How to store datatable in viewstate:
Introduction:
In my previous article i explained what is viewstate in asp.net, viewstate postback count example in asp.net,WPF Architecture,Asp.Net Validation Controls Tutorial,Asp.Net Ajax Tutorial and various articles on WPF and Asp.Net. Now i will explain how to store datatable in viewstate and retrieve it back.
Description:
In this example i will get data table from database and store it in viewstate in page load event and then in button click event i will get data table from viewstate and populates it in gridview. This is the example how to store large volumes of data in viewstate.
Take form which contains a label,a button and gridview like below
In the page load event and button click event write below code
In the page load event i am getting datatable from emp table and storing it in viewstate. in button click event i am getting viewstate emptable and binding that table to gridview. In this way you can store large amount of data in viewstate but it will increase the page size.
Conclusion:
I hope you got an idea how to store large data like datatables in viewstate.
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).
No comments:
Post a Comment
Please Give your Valuable Suggestions,Questions and Comments to improve my blog.