[Mono-bugs] [Bug 60800][Maj] New - Controls.Clear() prevents re-adding controls

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 27 Jun 2004 00:10:52 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by andrewarnott@byu.edu.

http://bugzilla.ximian.com/show_bug.cgi?id=60800

--- shadow/60800	2004-06-27 00:10:52.000000000 -0400
+++ shadow/60800.tmp.26208	2004-06-27 00:10:52.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 60800
+Product: Mono: Class Libraries
+Version: unspecified
+OS: SUSE 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Sys.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: AndrewArnott@byu.edu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Controls.Clear() prevents re-adding controls
+
+Description of Problem:
+After clearing controls from a ControlCollection using
+ControlCollection.Clear(), new controls can be added, but the cleared ones
+cannot be added again.
+
+Steps to reproduce the problem:
+I have included a tar file with a very simple web site that produces the
+problem.
+1. Put a PlaceHolder control on a web form.
+2. In the code-behind file, create a LiteralControl with some text and add
+it to the PlaceHolder.Controls collection using 
+LiteralControl test = new LiteralControl("HEY");
+PlaceHolder1.Controls.Add(test);
+3. Clear the collection
+PlaceHolder1.Controls.Clear();
+4. Add it again:
+PlaceHolder1.Controls.Add(test);
+5. But the control does NOT get added.  In fact, after step 4, 
+PlaceHolder1.Controls.Count == 0 
+
+Actual Results:
+Control does not get added the second time, and at run time the web page
+does NOT display the control.
+
+Expected Results:
+The control to be there at first, then get removed at the Clear() method,
+then get added again and display on the web page at runtime.
+
+How often does this happen? 
+Every time.
+
+Additional Information:
+I will attach a very small test case.