public void AddAt(int index, TreeNode child) { if (child == null) { throw new ArgumentNullException("child"); } if (this._updateParent) { if ((child.Owner != null) && (child.Parent == null)) { child.Owner.Nodes.Remove(child); } if (child.Parent != null) { child.Parent.ChildNodes.Remove(child); } if (this._owner != null) { child.SetParent(this._owner); child.SetOwner(this._owner.Owner); } } this._list.Insert(index, child); this._version++; if (this._isTrackingViewState) { ((IStateManager)child).TrackViewState(); child.SetDirty(); } this.Log.Add(new LogItem(LogItemType.Insert, index, this._isTrackingViewState)); }
public void AddAt(int index, TreeNode child) { if (child == null) { throw new ArgumentNullException("child"); } if (this._updateParent) { if ((child.Owner != null) && (child.Parent == null)) { child.Owner.Nodes.Remove(child); } if (child.Parent != null) { child.Parent.ChildNodes.Remove(child); } if (this._owner != null) { child.SetParent(this._owner); child.SetOwner(this._owner.Owner); } } this._list.Insert(index, child); this._version++; if (this._isTrackingViewState) { ((IStateManager) child).TrackViewState(); child.SetDirty(); } this.Log.Add(new LogItem(LogItemType.Insert, index, this._isTrackingViewState)); }