View State Management ASP.Net
ASP.Net is stateless , that means when we submit page to server , server generate new HTML for that page and deliver us.The value we entered , get loss .For Example we have entered some information of student and send it to Server , when server return the page , the data i have entered losses.
View State is a good technique to handle State Management .View State is actually a hidden field which hold data in base 64 encrypted format.If you go to view HTML of the page , you will notice
ASP.Net is stateless , that means when we submit page to server , server generate new HTML for that page and deliver us.The value we entered , get loss .For Example we have entered some information of student and send it to Server , when server return the page , the data i have entered losses.
To solve the problem , different framework introduced different technique .In ASP.Net , there are two type of technique , server Based & Client Based .
It is always recomended to use as little as possible , view state make extra overhead on perfoemance ,but little .We can enable/disable bu enter enableViewState=true/false.
Now we will discuss how , view state overhead effect .We have data and running two mode
enableViewState=true/false .Let us see the performance.
Now , notice size of page increase , that means , it will take more time with View State , that means View State has a effect on Page performance.An extra overload make a page little bit slow in loading.
Now , can we control page level view state & control level view state ? can we do disable page view state and enable control view state , the answer is 'yes' , Asp.Net offer this solution also .In the page top just write enableViewState=false , this makes , page view state off , now we can turn on control of ASP.Net ViewStatemode enable disable will enable / disable will enable /disable control by control basis.
Some point to remember
- View State Loaded after page_init.
- View State created after page_prerender.
- View State is encrypted base 64 algorithm. There are also encryption option on View State , we can do it elthier page level
OR
Three Option are
Always : Always encrypt view state.
Auto :encryption if the control on thre page request it.
Never :Recommended not use
No comments:
Post a Comment