protected override void OnDataBinding(EventArgs e) { base.OnDataBinding(e); this.Controls.Clear(); base.ClearChildViewState(); this.dataKeysCollection = null; this.CreateControlHierarchy(true); base.ChildControlsCreated = true; this.TrackViewState(); }
public void Constructor_Null () { DataKeyCollection dkc = new DataKeyCollection (null); Assert.IsNotNull (dkc, "ctor"); Assert.IsFalse (dkc.IsReadOnly, "IsReadOnly"); Assert.IsFalse (dkc.IsSynchronized, "IsSynchronized"); Assert.IsTrue (Object.ReferenceEquals (dkc, dkc.SyncRoot), "SyncRoot"); // unusable Assert.AreEqual (0, dkc.Count, "NRE"); }
/// <internalonly/> /// <devdoc> /// <para>Raises the <see langword='DataBinding '/>event of a <see cref='System.Web.UI.WebControls.BaseDataList'/> /// .</para> /// </devdoc> protected override void OnDataBinding(EventArgs e) { base.OnDataBinding(e); // reset the control state Controls.Clear(); ClearChildViewState(); // and create the control hierarchy using the datasource dataKeysCollection = null; CreateControlHierarchy(true); ChildControlsCreated = true; TrackViewState(); }
public void Constructor_Empty () { ArrayList al = new ArrayList (); DataKeyCollection dkc = new DataKeyCollection (al); Assert.AreEqual (0, dkc.Count, "Count0"); Assert.IsFalse (dkc.IsReadOnly, "IsReadOnly"); Assert.IsFalse (dkc.IsSynchronized, "IsSynchronized"); Assert.IsTrue (Object.ReferenceEquals (dkc, dkc.SyncRoot), "SyncRoot"); al.Add (String.Empty); Assert.AreEqual (1, dkc.Count, "Count++"); // note: no add/insert/remove/... Assert.AreEqual (String.Empty, dkc[0], "[0]"); al.Clear (); Assert.AreEqual (0, dkc.Count, "Count--"); // we can add/remove from the original ArrayList }