Viewstate is used primarily by server controls to retain state only on pages that post data back to themselves. The information is passed to the client and read back in a specific hidden variable called _VIEWSTATE.
You are not going to read about What & Why viewstate here, but how it affects the performance
As the view state grows larger it affects performance.Very large viewstate affects the efficiency of garbage collection,increses the CPU cycles and last but not least, your page takes longer time to download and render, which is not really accepted in all cases especially when you have a slow connection or a dial up connection.
Disable view state if you do not need it: Make sure that you evaluate each page (in both page and control scope) to determine whether you need view state to be enabled or not. Viewstate adds overhead to each request. The couple of things that need to be higly considered in this overhead is the increased page sizes sent to the client as well as a serialization and deserialization cost.
Minimize the number of objects you store in viewstate: You do not need viewstate under the following conditions: -The page does not post back to itself; the page is only used for output and does not rely on response processing. -Your page’s server controls do not handle events and you have no dynamic or data-bound property values (or they are set in code on every request). -If you are ignoring old data and repopulating the server control every time the page is refreshed.
Determine the size of your view state: You need to evaluate your use of viewstate for each page. To determine a page’s viewstate size, you can enable tracing and see each how each control uses it. Disable viewstate on a control-by-control basis.
Its really important to take care to reduce the size of your view state.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|