Different types of state management?
There are two different types of state management:
- Client Side State Management
View State
Hidden Field
Cookies
Control State
- Server Side State Management
Session
Application Object
Caching
Database
Client Side state management does not use any server resource , it store information using client side option. Server Side state management use server side resource for store data. Selection of client side and server side state management should be based on your requirements and the selection criteria that are already given.
What is view state?
View State
is one of the most important and useful client side state management mechanism. It can store the page value at the time of post back (Sending and Receiving information from Server)
of your page. ASP.NET pages provide the ViewState
property as a built-in structure for automatically storing values between multiple requests for the same page.
Example:
If you want to add one variable in View State,
ViewState["Var"]=Count;
For Retrieving information from View State
string Test=ViewState["TestVal"];
Sometimes you may need to typecast ViewState Value to retreive. As I give an Example to strore and retreive object in view state in the last of this article.
Advantages of view state?
This are the main advantage of using View State:
- Easy to implement
- No server resources are required
- Enhanced security features ,like it can be encoded and compressed.
Disadvantages of view state?
This are the main disadvantages of using View State:
- It can be performance overhead if we are going to store larger amount of data , because it is associated with page only.
- Its stored in a hidden filed in hashed format (which I have discussed later) still it can be easily trapped.
- It does not have any support on mobile devices.
No comments:
Post a Comment
We are here to listen you, Comment your valueable opinion...!!!