While doing some research for something I was working on, I came across this blog about ASP.NET and the Viewstate. This is a must read for those who are somewhat familiar with the viewstate and those who believe they know it all.
The following are some points that I took away from the article:
- an ASP.NET control will automatically restore entered/selected values even if the ViewState is DISABLED! (wait, what? I thought that is what the ViewState was for?)
- the Viewstate is typically only required for simple controls if the controls will be hidden between post backs (otherwise, see point above)
- if you databind your control on each request in the OnInit event, you can disable the ViewState and the control will still automatically restore entered/selected values