Viewstate turn me really nuts !
I don't understand why a such promising technical stuff like Viewstate is so badly documented and implemented in .Net.
Manipulating Viewstate on a page is quite easy, using a property to save a state with a pair of get and set, fine.
But try just to play with Viewstate between a control and a page, or worst, between two controls, and you can see a lovely idea turning to a dark nightmare !
I can't understand why I am able to read a Viewstate of a control in Debug mode, doing something like:
Page.findcontrol("myctl").viewstate("Myvalue")
And why I can't use this sentence in my code ? Because the compiler will produce an error saying that the Viewstate of the page is Protected and not public.
What the hell does it mean ?? The only reliable solution I found for the moment is to go back to the old trick of using hidden input box.
This works perfectly.
So why .Net guys claims everywhere that Viewstate is there to replace our old habit to use hidden fields if it's not true. And so , what is the solution to pass values from one control to another using Viewstate ?