2002-07-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.UI / ControlCollection.cs
index c24e2fecf6b172ddddb3f1f31b3659e62664f1ef..4c08bcc70dbdc87ced4a4b2c59ab53e5414f7dfe 100755 (executable)
@@ -56,6 +56,7 @@ namespace System.Web.UI {
                                throw new HttpException ();
 
                        list.Add (child);
+                       owner.AddedControl (child, list.Count - 1);
                }
 
                public virtual void AddAt (int index, Control child)
@@ -69,10 +70,12 @@ namespace System.Web.UI {
                        if (IsReadOnly)
                                throw new HttpException ();
 
-                       if (index == -1)
+                       if (index == -1){
                                Add (child);
-                       else
+                       } else {
                                list [index] = child;
+                               owner.AddedControl (child, index);
+                       }
                }
 
                public virtual void Clear ()
@@ -82,7 +85,7 @@ namespace System.Web.UI {
 
                public virtual bool Contains (Control c)
                {
-                       return list.Contains (c as object);
+                       return list.Contains (c);
                }
 
                public void CopyTo (Array array, int index)
@@ -97,12 +100,13 @@ namespace System.Web.UI {
 
                public virtual int IndexOf (Control c)
                {
-                       return list.IndexOf (c as object);
+                       return list.IndexOf (c);
                }
 
                public virtual void Remove (Control value)
                {
-                       list.Remove (value as object);
+                       list.Remove (value);
+                       owner.RemovedControl (value);
                }
 
                public virtual void RemoveAt (int index)
@@ -110,7 +114,9 @@ namespace System.Web.UI {
                        if (IsReadOnly)
                                throw new HttpException ();
 
+                       Control value = (Control) list [index];
                        list.RemoveAt (index);
+                       owner.RemovedControl (value);
                }
        }
 }