ViewState restoration does not call any setters
public bool Selected {
get {
object o = ViewState["Selected"];
if (o == null) {
return false;
}
return (bool)o;
}
set {
ViewState["Selected"] = value;
if (Owner == null) return;
if (value) {
Owner.SetSelectedNode(this);
}
else if (this == Owner.SelectedNode) {
Owner.SetSelectedNode(null);
}
}
}
public bool Selected {
get {
object o = ViewState["Selected"];
if (o == null) {
return false;
}
return (bool)o;
}
set {
ViewState["Selected"] = value;
NotifyOwnerSelected();
}
}
// ...
private void NotifyOwnerSelected() {
object o = ViewState["Selected"];
bool value = (o == null ? false : ( bool )o);
if (Owner == null ) {
return ;
}
else if (value) {
Owner.SetSelectedNode( this );
}
else if (this == Owner.SelectedNode) {
Owner.SetSelectedNode( null );
}
}
// ...
// This method is not mandatory if this is a Control.
void IStateManager.LoadViewState(object state) {
LoadViewState(state);
}
protected virtual void LoadViewState(object state) {
// Replace the following line with base.LoadViewState
// if the class is a control and not simply
// a class that implements IStateManager.
((IStateManager)ViewState).LoadViewState(state);
NotifyOwnerSelected();
}