Reputation: 1998
I haven’t yet started learning Asp.Net 4.0, but I did read a bit on ViewState, where there is a new property ViewStateMode. In earlier versions of Asp.Net, if parent control had its ViewState disabled, then child controls also had their ViewState disabled, even if their EnableViewState was set to true.
a) Thus if I understand it correctly, then a child control C having ViewStateMode property set to “Enable” causes C to save its view state, even if parent control has its view state disabled?
b) Is there a reason why ViewStateMode property hasn’t/couldn’t be implemented in earlier versions of Asp.Net?
thanx
Upvotes: 4
Views: 1118
Reputation: 415
EnableViewState allows saving view state. ViewStateMode sets whether to use it or not. By Default ViewStateMode is set to Inherit for every control.
A) Absolutely.
B) In previews versions If parent viewstate is disabled, child viewstate gets disabled also. Lots of users Demanded new ViewStateMode for child control that can overwrite Parent ViewStateMode. So here you have it. Is there any reasons why there was no color but black and white TV's in 1920's?
Upvotes: 0
Reputation: 273244
a) correct.
b) It could have but it wasn't. And EnableViewState could not be changed w/o breaking existing code.
Upvotes: 2