We're about to start rebuilding one of our ASP.NET projects and I would like to try developing it without viestate turned on (disabled in web.config).
I know about the upsides and downsides of viewstate and generally speaking what it keeps track of in comparison to control state, however I would like to know:
What are the principle development process differences? Ie how differently do you structure your Page_Load etc?
Is there any functionality in the standard ASP.NET controls that really will just not work without viewstate turned on?
Also, are there any detailed articles on the workflow differences between working with and without VS?
If you disable ViewState, and a page needs it, the page will no longer work.
By default, ViewState is enabled for all server controls. ViewState can be enabled and disabled in any of the following ways: Control Level. Page Level.
View state enables a server control to maintain its state across HTTP requests. View state for a control is enabled if all of the following conditions are met: The EnableViewState property for the page is set to true . The EnableViewState property for the control is set to true .
Since each control is responsible for its own viewstate, and stores required data in it, so it can render/postback etc, it ends up that there is a lage duplication in the viewstate, since the Person control stores all the data, and then each child control stores its own data again.
If you are that against viewstate - why not try using the MVC framework? It may be an easier adjustment.
Most controls like TextBoxes and DropDownLists will function perfectly well without viewstate.
I don't know of any development process issues, other than any controls or properties created or modified through code will not persist without viewstate, so you would have to recreate/modify them on a postback.
I have some very big pages with large viewstates. I did an experiment to disable viewstate for the entire project, and found (at first) no noticeable loss of functionality. Then a few little issues came up in testing, so we reinstated it. But our 300 page web app was probably 99% functional without viewstate. The issues we had were centred around datagrids - paging mainly, and dynamically created controls and other things modified by code behind, and thus not persisted without viewstate.
This is a very good article on Viewstate:
http://msdn.microsoft.com/en-us/library/ms972976.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With