Design Days: View State Performance Tips
In controls like listbox controls, items added to the list are carried between client and server via view state... When the list of items become considerably large it starts hitting the performance and increasing the traffic between client and server... To avoid this set the EnableViewState property of the control to be false... By this unnecessary data will not move back and forth to the server... Though, do note that by doing so your selected items will no longer remain selected after postback and you will have to write special code to achieve this functionality...
The same problems are also faced in controls like Datagrid so do ensure that you use View State judiciously and give enough thoughts while designing your application...
To see the view state of a page right click on displayed page and 'view source', here you will see a long line of junk characters for __VIEWSTATE property... This is the encrypted view state of your controls... Well, that makes me add one more point the performance... All the viewstate data that passes to and comes back from server goes through the cycles of encryption and decryption which in itself is also a costly affair hitting performance...
Note: Ben Miller from Microsoft corrected my silly mistake here... view state is Base64 encoded when it moves back and forth from client to server.... It is not encrypted... Thanks for the correction Ben... Btw, Ben Miller is also ASP.Net MVP Lead of North America... !!
PS: Did you read my suggestion to Microsoft long time back... You will like it... Click Here
No comments:
Post a Comment