Browse Source

2007-02-01 Adar Wesley <[email protected]>

        * FormView.cs: fixed events ModeChanging and ModeChanged
        to be raized in all relevant situations.

2007-02-01  Adar Wesley <[email protected]>

        * Control.cs: Changed UniqueId implementation to have '$' and not ':'
        to conform to MS.  This led to updating several Tests that referenced
        the UniqueId as string.

svn path=/trunk/mcs/; revision=72102
Adar Wesley 19 years ago
parent
commit
4be48fc47e

+ 5 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,8 @@
+2007-02-01 Adar Wesley <[email protected]>
+
+	* FormView.cs: fixed events ModeChanging and ModeChanged 
+	to be raized in all relevant situations.
+
 2007-02-01 Igor Zelmanovich <[email protected]>
 
 	* ValidationSammary.cs: fixed:

+ 10 - 21
mcs/class/System.Web/System.Web.UI.WebControls/FormView.cs

@@ -1228,11 +1228,11 @@ namespace System.Web.UI.WebControls
 				break;
 					
 			case DataControlCommands.EditCommandName:
-				ProcessChangeMode (FormViewMode.Edit);
+				ProcessChangeMode (FormViewMode.Edit, false);
 				break;
 					
 			case DataControlCommands.NewCommandName:
-				ProcessChangeMode (FormViewMode.Insert);
+				ProcessChangeMode (FormViewMode.Insert, false);
 				break;
 					
 			case DataControlCommands.UpdateCommandName:
@@ -1264,7 +1264,7 @@ namespace System.Web.UI.WebControls
 			int newIndex = args.NewPageIndex;
 			if (newIndex < 0 || newIndex >= PageCount)
 				return;
-			EndRowEdit (false);
+			EndRowEdit (false, false);
 			PageIndex = newIndex;
 			OnPageIndexChanged (EventArgs.Empty);
 		}
@@ -1277,9 +1277,9 @@ namespace System.Web.UI.WebControls
 			RequireBinding ();
 		}
 
-		void ProcessChangeMode (FormViewMode newMode)
+		void ProcessChangeMode (FormViewMode newMode, bool cancelingEdit)
 		{
-			FormViewModeEventArgs args = new FormViewModeEventArgs (newMode, false);
+			FormViewModeEventArgs args = new FormViewModeEventArgs (newMode, cancelingEdit);
 			OnModeChanging (args);
 
 			if (args.Cancel || !IsBoundUsingDataSourceID)
@@ -1292,13 +1292,7 @@ namespace System.Web.UI.WebControls
 		
 		void CancelEdit ()
 		{
-			FormViewModeEventArgs args = new FormViewModeEventArgs (FormViewMode.ReadOnly, true);
-			OnModeChanging (args);
-
-			if (args.Cancel || !IsBoundUsingDataSourceID)
-				return;
-
-			EndRowEdit ();
+			EndRowEdit (true, true);
 		}
 
 		public virtual void UpdateItem (bool causesValidation)
@@ -1335,7 +1329,7 @@ namespace System.Web.UI.WebControls
 			OnItemUpdated (dargs);
 
 			if (!dargs.KeepInEditMode)				
-				EndRowEdit ();
+				EndRowEdit (true, false);
 
 			return dargs.ExceptionHandled;
 		}
@@ -1371,7 +1365,7 @@ namespace System.Web.UI.WebControls
 			OnItemInserted (dargs);
 
 			if (!dargs.KeepInInsertMode)				
-				EndRowEdit ();
+				EndRowEdit (true, false);
 
 			return dargs.ExceptionHandled;
 		}
@@ -1408,15 +1402,10 @@ namespace System.Web.UI.WebControls
 			return dargs.ExceptionHandled;
 		}
 		
-		void EndRowEdit ()
-		{
-			EndRowEdit (true);
-		}
-
-		void EndRowEdit (bool switchToDefaultMode) 
+		void EndRowEdit (bool switchToDefaultMode, bool cancelingEdit) 
 		{
 			if (switchToDefaultMode)
-				ChangeMode (DefaultMode);
+				ProcessChangeMode (DefaultMode, cancelingEdit);
 			oldEditValues = new DataKey (new OrderedDictionary ());
 			currentEditRowKeys = null;
 			currentEditOldValues = null;

+ 6 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,9 @@
+2007-02-02  Adar Wesley <[email protected]>
+
+	* Control.cs: Changed UniqueId implementation to have '$' and not ':'
+	to conform to MS.  This led to updating several Tests that referenced
+	the UniqueId as string.
+
 2007-01-30  Eyal Alaluf <[email protected]>
 
 	* ClientScriptManager.cs: Fix Igor's last changes for TARGET_JVM.

+ 24 - 5
mcs/class/System.Web/System.Web.UI/Control.cs

@@ -136,7 +136,11 @@ namespace System.Web.UI
 		{
 			defaultNameArray = new string [100];
 			for (int i = 0 ; i < 100 ; i++)
+#if NET_2_0
+				defaultNameArray [i] = String.Format("ctl{0:D2}", i);
+#else
 				defaultNameArray [i] = "_ctl" + i;
+#endif
 		}
 
                 public Control()
@@ -203,7 +207,11 @@ namespace System.Web.UI
 				string client = UniqueID;
 
 				if (client != null)
+#if NET_2_0
+					client = client.Replace (IdSeparator, ClientIDSeparator);
+#else
 					client = client.Replace (':', ClientIDSeparator);
+#endif
 				
 				stateMask |= ID_SET;
 				return client;
@@ -454,7 +462,11 @@ namespace System.Web.UI
 					return uniqueID;
 				}
 
+#if NET_2_0
+				uniqueID = prefix + IdSeparator + _userId;
+#else
 				uniqueID = prefix + ":" + _userId;
+#endif
 				return uniqueID;
                         }
                 }
@@ -584,7 +596,11 @@ namespace System.Web.UI
 		{
 			string defaultName;
 			if (defaultNumberID > 99) {
+#if NET_2_0
+				defaultName = "ctl" + defaultNumberID++;
+#else
 				defaultName = "_ctl" + defaultNumberID++;
+#endif
 			} else {
 				defaultName = defaultNameArray [defaultNumberID++];
 			}
@@ -790,17 +806,20 @@ namespace System.Web.UI
 
 			if (!HasControls ())
 				return null;
-
-			int colon = id.IndexOf (':', pathOffset);
-			if (colon == -1)
+#if NET_2_0
+			int separatorIdx = id.IndexOf (IdSeparator, pathOffset);
+#else
+			int separatorIdx = id.IndexOf (':', pathOffset);
+#endif
+			if (separatorIdx == -1)
 				return LookForControlByName (id.Substring (pathOffset));
 			
-			string idfound = id.Substring (pathOffset, colon - pathOffset);
+			string idfound = id.Substring (pathOffset, separatorIdx - pathOffset);
 			namingContainer = LookForControlByName (idfound);
 			if (namingContainer == null)
 				return null;
 
-			return namingContainer.FindControl (id, colon + 1);
+			return namingContainer.FindControl (id, separatorIdx + 1);
                 }
 
                 protected virtual void LoadViewState(object savedState)

+ 6 - 1
mcs/class/System.Web/Test/System.Web.UI.HtmlControls/HtmlTextAreaTest.cs

@@ -211,7 +211,12 @@ namespace MonoTests.System.Web.UI.HtmlControls {
 			ctrl.Controls.Add (ta);
 			ta.Name = "mono";
 			ta.ID = "go";
-			Assert.AreEqual (" name=\"UC:go\" id=\"UC_go\"", ta.RenderAttributes ());
+#if NET_2_0
+			string expected = " name=\"UC$go\" id=\"UC_go\"";
+#else
+			string expected = " name=\"UC:go\" id=\"UC_go\"";
+#endif
+			Assert.AreEqual (expected, ta.RenderAttributes ());
 		}
 
 		[Test]

+ 13 - 12
mcs/class/System.Web/Test/System.Web.UI.WebControls/DetailsViewTest.cs

@@ -1767,15 +1767,15 @@ namespace MonoTests.System.Web.UI.WebControls
 #else
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("DetailsView1:_ctl1c");
-			fr.Controls.Add ("DetailsView1:_ctl2c");
-			fr.Controls.Add ("DetailsView1:_ctl3c");
+			fr.Controls.Add ("DetailsView1$ctl01c");
+			fr.Controls.Add ("DetailsView1$ctl02c");
+			fr.Controls.Add ("DetailsView1$ctl03c");
 
-			fr.Controls ["__EVENTTARGET"].Value = "DetailsView1:_ctl4c";
+			fr.Controls ["__EVENTTARGET"].Value = "DetailsView1$ctl04c";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["DetailsView1:_ctl1c"].Value = "123";
-			fr.Controls ["DetailsView1:_ctl2c"].Value = "123";
-			fr.Controls ["DetailsView1:_ctl3c"].Value = "123";
+			fr.Controls ["DetailsView1$ctl01c"].Value = "123";
+			fr.Controls ["DetailsView1$ctl02c"].Value = "123";
+			fr.Controls ["DetailsView1$ctl03c"].Value = "123";
 #endif
 			t.Request = fr;			
 			t.Run ();
@@ -1925,13 +1925,13 @@ namespace MonoTests.System.Web.UI.WebControls
 #else
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("DetailsView1:_ctl1c");
-			fr.Controls.Add ("DetailsView1:_ctl2c");
+			fr.Controls.Add ("DetailsView1$ctl01c");
+			fr.Controls.Add ("DetailsView1$ctl02c");
 
-			fr.Controls ["__EVENTTARGET"].Value = "DetailsView1:_ctl3c";
+			fr.Controls ["__EVENTTARGET"].Value = "DetailsView1$ctl03c";
 			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["DetailsView1:_ctl1c"].Value = "1";
-			fr.Controls ["DetailsView1:_ctl2c"].Value = "2";
+			fr.Controls ["DetailsView1$ctl01c"].Value = "1";
+			fr.Controls ["DetailsView1$ctl02c"].Value = "2";
 #endif
 			t.Request = fr;
 			t.Run ();
@@ -2768,3 +2768,4 @@ namespace MonoTests.System.Web.UI.WebControls
 
 
 
+

+ 27 - 47
mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs

@@ -1569,7 +1569,6 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 		
 
 		[Test]
-		[Category ("NotDotNet")] // becaue Naming container: use "FormView1$....." for DotNet
 		[Category ("NunitWeb")]
 		public void FormView_EditPostback ()
 		{
@@ -1604,7 +1603,7 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			FormRequest fr = new FormRequest (t.Response, "form1");
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:EditButton";
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$EditButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
 			t.Request = fr;
 			pageHTML = t.Run ();
@@ -1635,12 +1634,12 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			fr = new FormRequest (t.Response, "form1");
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("FormView1:FNameEdit");
-			fr.Controls.Add ("FormView1:LNameEdit");
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:UpdateButton";
+			fr.Controls.Add ("FormView1$FNameEdit");
+			fr.Controls.Add ("FormView1$LNameEdit");
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$UpdateButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";			
-			fr.Controls["FormView1:FNameEdit"].Value = "Merav";
-			fr.Controls["FormView1:LNameEdit"].Value = "Test";			
+			fr.Controls["FormView1$FNameEdit"].Value = "Merav";
+			fr.Controls["FormView1$LNameEdit"].Value = "Test";			
 			t.Request = fr;
 			pageHTML = t.Run ();
 			newHtml = pageHTML.Substring (pageHTML.IndexOf ("start") + 5, pageHTML.IndexOf ("end") - pageHTML.IndexOf ("start") - 5);
@@ -1671,7 +1670,7 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			fr = new FormRequest (t.Response, "form1");
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:EditButton";
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$EditButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";			
 			t.Request = fr;
 			pageHTML = t.Run ();
@@ -1683,11 +1682,11 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			fr = new FormRequest (t.Response, "form1");
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("FormView1:FNameEdit");
-			fr.Controls.Add ("FormView1:LNameEdit");
-			fr.Controls["FormView1:FNameEdit"].Value = "EditFirstName";
-			fr.Controls["FormView1:LNameEdit"].Value = "EditLastName";
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:CancelUpdateButton";
+			fr.Controls.Add ("FormView1$FNameEdit");
+			fr.Controls.Add ("FormView1$LNameEdit");
+			fr.Controls["FormView1$FNameEdit"].Value = "EditFirstName";
+			fr.Controls["FormView1$LNameEdit"].Value = "EditLastName";
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$CancelUpdateButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
 			t.Request = fr;
 			pageHTML = t.Run ();
@@ -1718,13 +1717,12 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 		}
 
 		[Test]
-		[Category ("NotWorking")] //Implementation specific for mono 
 		[Category ("NunitWeb")]
 		public void FormView_FireEvent_1 ()
 		{
 			WebTest t = new WebTest ("FormViewInsertEditDelete.aspx");
 			t.Invoker = PageInvoker.CreateOnInit (EditPostbackFireEvent_Init);
-			t.Run ();
+			string html = t.Run ();
 			//Edit button postback (change to edit mode - buttons "Update" and "Cancel" should appear.
 
 			FormRequest fr = new FormRequest (t.Response, "form1");
@@ -1733,7 +1731,7 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			fr.Controls["__EVENTTARGET"].Value = "FormView1$EditButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
 			t.Request = fr;
-			t.Run ();
+			html = t.Run ();
 
 			ArrayList eventlist = t.UserData as ArrayList;
 			if (eventlist == null)
@@ -1751,12 +1749,12 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			fr.Controls.Add ("__EVENTARGUMENT");
 			fr.Controls.Add ("FormView1$FNameEdit");
 			fr.Controls.Add ("FormView1$LNameEdit");
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:UpdateButton";
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$UpdateButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
 			fr.Controls["FormView1$FNameEdit"].Value = "Merav";
 			fr.Controls["FormView1$LNameEdit"].Value = "Test";
 			t.Request = fr;
-			t.Run ();
+			html = t.Run ();
 
 			eventlist = t.UserData as ArrayList;
 			if (eventlist == null)
@@ -1909,7 +1907,6 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 		#endregion
 
 		[Test]
-		[Category ("NotWorking")] //Implementation specific for mono 
 		[Category ("NunitWeb")]
 		public void FormView_FireEvent_3 ()
 		{
@@ -1993,7 +1990,6 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 		#endregion
 
 		[Test]
-		[Category ("NotWorking")] //Implementation specific for mono 
 		[Category ("NunitWeb")]
 		public void FormView_FireEvent_4 ()
 		{
@@ -2063,7 +2059,6 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 		#endregion
 
 		[Test]
-		[Category ("NotWorking")] //Implementation specific for mono 
 		[Category ("NunitWeb")]
 		public void FormView_FireEvent_5 ()
 		{
@@ -2132,7 +2127,6 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 		#endregion
 
 		[Test]
-		[Category ("NotDotNet")] // becaue Naming container: use "FormView1$....." for DotNet
 		[Category ("NunitWeb")] 
 		public void FormView_InsertPostback ()
 		{
@@ -2145,7 +2139,7 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			FormRequest fr = new FormRequest (t.Response, "form1"); 
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");			
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:NewButton";
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$NewButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";						
 			t.Request = fr;
 			pageHTML = t.Run ();
@@ -2175,13 +2169,13 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			fr = new FormRequest (t.Response, "form1");
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("FormView1:IDInsert");
-			fr.Controls.Add ("FormView1:FNameInsert");
-			fr.Controls.Add ("FormView1:LNameInsert");
-			fr.Controls["FormView1:IDInsert"].Value = "33";
-			fr.Controls["FormView1:FNameInsert"].Value = "InsertFirstName";
-			fr.Controls["FormView1:LNameInsert"].Value ="InsertLastName";
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:InsertButton";
+			fr.Controls.Add ("FormView1$IDInsert");
+			fr.Controls.Add ("FormView1$FNameInsert");
+			fr.Controls.Add ("FormView1$LNameInsert");
+			fr.Controls["FormView1$IDInsert"].Value = "33";
+			fr.Controls["FormView1$FNameInsert"].Value = "InsertFirstName";
+			fr.Controls["FormView1$LNameInsert"].Value ="InsertLastName";
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$InsertButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
 			t.Request = fr;
 			pageHTML = t.Run ();			
@@ -2206,26 +2200,12 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 		}		
 
 		[Test]
-		[Category ("NotDotNet")] // becaue Naming container: use "FormView1$DeleteButton" for DotNet
 		[Category ("NunitWeb")]
 		public void FormView_DeleteAndEmptyTemplatePostback ()
 		{
 			WebTest t = new WebTest ("FormViewInsertEditDelete.aspx");
 			string pageHTML = t.Run ();
 			
-			//Before Delete
-			//
-			// The following line fails, it returns "false" instead of true, because
-			// the page actually contains the value "1002", not 1001.
-			//
-//Failures: 1) MonoTests.System.Web.UI.WebControls.FormViewTest.FormView_DeleteAndEmptyTemplatePostback : BeforeDelete1 ^M
-//        expected:<True>^M
-//         but was:<False>^M
-//  at MonoTests.System.Web.UI.WebControls.FormViewTest.FormView_DeleteAndEmptyTemplatePostback () [0x00018] in /home/cvs/mcs/class/System.Web/Test/System.Web.UI.WebControls/FormViewTest.cs:1769
-//  at <0x00000> <unknown method>
-//  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
-//  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00056] in /home/cvs/mcs/class/corlib/System.Reflection/MonoMethod.cs:143
-//			
 			Assert.AreEqual (true, pageHTML.Contains ("1001"), "BeforeDelete1");
 			Assert.AreEqual (true, pageHTML.Contains ("Mahesh"), "BeforeDelete2");
 			Assert.AreEqual (true, pageHTML.Contains ("Chand"), "BeforeDelete3");
@@ -2234,7 +2214,7 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			FormRequest fr = new FormRequest (t.Response, "form1");
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:DeleteButton";
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$DeleteButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
 			t.Request = fr;
 			pageHTML = t.Run ();			
@@ -2249,7 +2229,7 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			fr = new FormRequest (t.Response, "form1");
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:DeleteButton";
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$DeleteButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
 			t.Request = fr;
 			pageHTML = t.Run ();
@@ -2263,7 +2243,7 @@ CommandEventArgs cargs = new CommandEventArgs ("Page", "Prev");
 			fr = new FormRequest (t.Response, "form1");
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls["__EVENTTARGET"].Value = "FormView1:DeleteButton";
+			fr.Controls["__EVENTTARGET"].Value = "FormView1$DeleteButton";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
 			t.Request = fr;
 			pageHTML = t.Run ();			

+ 181 - 180
mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs

@@ -337,52 +337,52 @@ namespace MonoTests.System.Web.UI.WebControls
 			public static int GetCount () {
 				return GetList ().Count;
 			}
-		}
-		
-		public class data
-		{
-			private static ArrayList _data = new ArrayList ();
-
-			static data () {
-				_data.Add (new DataItem (1, "heh1"));
-				_data.Add (new DataItem (2, "heh2"));
-			}
-
-			public data () {
-			}
-
-			public ArrayList GetAllItems () {
-				return _data;
-			}
-
-			public void UpdateItem (int id, string name) {
-				foreach (DataItem i in _data) {
-					if (i.ID == id) {
-						i.Name = name;
-						return;
-					}
-				}
-			}
-		}
-
-		public class DataItem
-		{
-			int _id = 0;
-			string _name = "";
-
-			public DataItem (int id, string name) {
-				_id = id;
-				_name = name;
-			}
-
-			public int ID {
-				get { return _id; }
-			}
-
-			public string Name {
-				get { return _name; }
-				set { _name = value; }
-			}
+		}
+		
+		public class data
+		{
+			private static ArrayList _data = new ArrayList ();
+
+			static data () {
+				_data.Add (new DataItem (1, "heh1"));
+				_data.Add (new DataItem (2, "heh2"));
+			}
+
+			public data () {
+			}
+
+			public ArrayList GetAllItems () {
+				return _data;
+			}
+
+			public void UpdateItem (int id, string name) {
+				foreach (DataItem i in _data) {
+					if (i.ID == id) {
+						i.Name = name;
+						return;
+					}
+				}
+			}
+		}
+
+		public class DataItem
+		{
+			int _id = 0;
+			string _name = "";
+
+			public DataItem (int id, string name) {
+				_id = id;
+				_name = name;
+			}
+
+			public int ID {
+				get { return _id; }
+			}
+
+			public string Name {
+				get { return _name; }
+				set { _name = value; }
+			}
 		}
 
 		public const string BOOLFIELD = "bool";
@@ -398,9 +398,9 @@ namespace MonoTests.System.Web.UI.WebControls
 			myds.Add ("France");
 			myds.Add ("Italy");
 			myds.Add ("Israel");
-			myds.Add ("Russia");
-#if DOT_NET
-			WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.GridViewUpdate.aspx", "GridViewUpdate.aspx");
+			myds.Add ("Russia");
+#if VISUAL_STUDIO
+			WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.GridViewUpdate.aspx", "GridViewUpdate.aspx");
 #else
 			WebTest.CopyResource (GetType (), "GridViewUpdate.aspx", "GridViewUpdate.aspx");
 #endif
@@ -909,17 +909,17 @@ namespace MonoTests.System.Web.UI.WebControls
 			ArrayList l = new ArrayList(); 
 			PokerGridView g = new PokerGridView ();
 			Assert.AreEqual (0, g.DoCreateChildControls (l, false), "CreateChildControls#1");
-		}
-
-		[Test]
-		public void GridView_NullDS ()
-		{
-			PokerGridView g = new PokerGridView ();
-			g.DataSource = null;
-			g.DataBind ();
-			Assert.AreEqual (0, g.Rows.Count, "NullDS");
-		}
-
+		}
+
+		[Test]
+		public void GridView_NullDS ()
+		{
+			PokerGridView g = new PokerGridView ();
+			g.DataSource = null;
+			g.DataBind ();
+			Assert.AreEqual (0, g.Rows.Count, "NullDS");
+		}
+
 		[Test]
 		public void GridView_CreateChildTable () {
 			PokerGridView g = new PokerGridView ();
@@ -2147,7 +2147,7 @@ namespace MonoTests.System.Web.UI.WebControls
 		[Test]
 		[Category ("NunitWeb")]
 		public void GridView_PostBackUpdateItem ()
-		{
+		{
 			WebTest t = new WebTest ();
 			PageDelegates pd = new PageDelegates ();
 			pd.Load = GridView_postbackupdateitem;
@@ -2207,8 +2207,8 @@ namespace MonoTests.System.Web.UI.WebControls
 		}
 
 		public static void GridView_postbackupdateitem (Page p)
-		{
-			if (!p.IsPostBack)
+		{
+			if (!p.IsPostBack)
 				DataObject.Reset ();
 
 			GridView grid = new GridView ();
@@ -2387,116 +2387,116 @@ namespace MonoTests.System.Web.UI.WebControls
 		{
 			PokerGridView g = new PokerGridView ();
 			object o = g.SelectedValue;
-		}
-
-		[Test]
-		[Category ("NunitWeb")]
-		[Category ("NotDotNet")]
-		public void GridViewUpdate () {
-			WebTest t = new WebTest ("GridViewUpdate.aspx");
-			string pageHTML = HtmlDiff.GetControlFromPageHtml (t.Run ());
-			
-			FormRequest fr = new FormRequest (t.Response, "form1");
-			fr.Controls.Add ("__EVENTTARGET");
-			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("GridView1:_ctl2:Name"); // for .NET use "GridView1$ctl02$Name"
-			fr.Controls.Add ("GridView1:_ctl3:Name");
-			fr.Controls ["__EVENTTARGET"].Value = "Button1";
-			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["GridView1:_ctl2:Name"].Value = "ABC";
-			fr.Controls ["GridView1:_ctl3:Name"].Value = "123";
-			t.Request = fr;
-			t.Invoker = PageInvoker.CreateOnLoad (GridView_postback);
-			pageHTML = HtmlDiff.GetControlFromPageHtml (t.Run ());
-			#region original
-			string original = @"<div>
-	<table cellspacing=""0"" rules=""all"" border=""1"" id=""GridView1"" style=""border-collapse:collapse;"">
-		<tr>
-			<th scope=""col"">ID</th><th scope=""col"">&nbsp;</th>
-		</tr><tr>
-			<td>1</td><td>
-                        <input name=""GridView1$ctl02$Name"" type=""text"" value=""ABC"" id=""GridView1_ctl02_Name"" />
-                        <input type=""button"" name=""GridView1$ctl02$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl02$b1','')"" id=""GridView1_ctl02_b1"" />
-                    </td>
-		</tr><tr>
-			<td>2</td><td>
-                        <input name=""GridView1$ctl03$Name"" type=""text"" value=""123"" id=""GridView1_ctl03_Name"" />
-                        <input type=""button"" name=""GridView1$ctl03$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl03$b1','')"" id=""GridView1_ctl03_b1"" />
-                    </td>
-		</tr>
-	</table>
-</div>";
-
-			#endregion			
-			HtmlDiff.AssertAreEqual (original, pageHTML, "GridViewUpdate #1");
-
-			fr = new FormRequest (t.Response, "form1");
-			fr.Controls.Add ("__EVENTTARGET");
-			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("GridView1:_ctl2:Name");
-			fr.Controls.Add ("GridView1:_ctl3:Name");
-			fr.Controls ["__EVENTTARGET"].Value = "GridView1:_ctl2:b1";
-			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["GridView1:_ctl2:Name"].Value = "ABC";
-			fr.Controls ["GridView1:_ctl3:Name"].Value = "123";
-			t.Request = fr;
-			t.Invoker = PageInvoker.CreateOnLoad (GridView_postback);
-			pageHTML = HtmlDiff.GetControlFromPageHtml (t.Run ());
-			#region original
-			original = @"<div>
-	<table cellspacing=""0"" rules=""all"" border=""1"" id=""GridView1"" style=""border-collapse:collapse;"">
-		<tr>
-			<th scope=""col"">ID</th><th scope=""col"">&nbsp;</th>
-		</tr><tr>
-			<td>1</td><td>
-                        <input name=""GridView1$ctl02$Name"" type=""text"" value=""ABC"" id=""GridView1_ctl02_Name"" />
-                        <input type=""button"" name=""GridView1$ctl02$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl02$b1','')"" id=""GridView1_ctl02_b1"" />
-                    </td>
-		</tr><tr>
-			<td>2</td><td>
-                        <input name=""GridView1$ctl03$Name"" type=""text"" value=""heh2"" id=""GridView1_ctl03_Name"" />
-                        <input type=""button"" name=""GridView1$ctl03$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl03$b1','')"" id=""GridView1_ctl03_b1"" />
-                    </td>
-		</tr>
-	</table>
-</div>";
-
-			#endregion
-			HtmlDiff.AssertAreEqual (original, pageHTML, "GridViewUpdate #2");
-
-			fr = new FormRequest (t.Response, "form1");
-			fr.Controls.Add ("__EVENTTARGET");
-			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("GridView1:_ctl2:Name");
-			fr.Controls.Add ("GridView1:_ctl3:Name");
-			fr.Controls ["__EVENTTARGET"].Value = "GridView1:_ctl3:b1";
-			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["GridView1:_ctl2:Name"].Value = "ABC";
-			fr.Controls ["GridView1:_ctl3:Name"].Value = "123";
-			t.Request = fr;
-			t.Invoker = PageInvoker.CreateOnLoad (GridView_postback);
-			pageHTML = HtmlDiff.GetControlFromPageHtml (t.Run ());
-			#region original
-			original = @"<div>
-	<table cellspacing=""0"" rules=""all"" border=""1"" id=""GridView1"" style=""border-collapse:collapse;"">
-		<tr>
-			<th scope=""col"">ID</th><th scope=""col"">&nbsp;</th>
-		</tr><tr>
-			<td>1</td><td>
-                        <input name=""GridView1$ctl02$Name"" type=""text"" value=""ABC"" id=""GridView1_ctl02_Name"" />
-                        <input type=""button"" name=""GridView1$ctl02$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl02$b1','')"" id=""GridView1_ctl02_b1"" />
-                    </td>
-		</tr><tr>
-			<td>2</td><td>
-                        <input name=""GridView1$ctl03$Name"" type=""text"" value=""123"" id=""GridView1_ctl03_Name"" />
-                        <input type=""button"" name=""GridView1$ctl03$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl03$b1','')"" id=""GridView1_ctl03_b1"" />
-                    </td>
-		</tr>
-	</table>
-</div>";
-
-			#endregion
-			HtmlDiff.AssertAreEqual (original, pageHTML, "GridViewUpdate #3");
+		}
+
+		[Test]
+		[Category ("NunitWeb")]
+		[Category ("NotDotNet")]
+		public void GridViewUpdate () {
+			WebTest t = new WebTest ("GridViewUpdate.aspx");
+			string pageHTML = HtmlDiff.GetControlFromPageHtml (t.Run ());
+			
+			FormRequest fr = new FormRequest (t.Response, "form1");
+			fr.Controls.Add ("__EVENTTARGET");
+			fr.Controls.Add ("__EVENTARGUMENT");
+			fr.Controls.Add ("GridView1$ctl02$Name"); // for .NET use "GridView1$ctl02$Name"
+			fr.Controls.Add ("GridView1$ctl03$Name");
+			fr.Controls ["__EVENTTARGET"].Value = "Button1";
+			fr.Controls ["__EVENTARGUMENT"].Value = "";
+			fr.Controls ["GridView1$ctl02$Name"].Value = "ABC";
+			fr.Controls ["GridView1$ctl03$Name"].Value = "123";
+			t.Request = fr;
+			t.Invoker = PageInvoker.CreateOnLoad (GridView_postback);
+			pageHTML = HtmlDiff.GetControlFromPageHtml (t.Run ());
+			#region original
+			string original = @"<div>
+	<table cellspacing=""0"" rules=""all"" border=""1"" id=""GridView1"" style=""border-collapse:collapse;"">
+		<tr>
+			<th scope=""col"">ID</th><th scope=""col"">&nbsp;</th>
+		</tr><tr>
+			<td>1</td><td>
+                        <input name=""GridView1$ctl02$Name"" type=""text"" value=""ABC"" id=""GridView1_ctl02_Name"" />
+                        <input type=""button"" name=""GridView1$ctl02$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl02$b1','')"" id=""GridView1_ctl02_b1"" />
+                    </td>
+		</tr><tr>
+			<td>2</td><td>
+                        <input name=""GridView1$ctl03$Name"" type=""text"" value=""123"" id=""GridView1_ctl03_Name"" />
+                        <input type=""button"" name=""GridView1$ctl03$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl03$b1','')"" id=""GridView1_ctl03_b1"" />
+                    </td>
+		</tr>
+	</table>
+</div>";
+
+			#endregion			
+			HtmlDiff.AssertAreEqual (original, pageHTML, "GridViewUpdate #1");
+
+			fr = new FormRequest (t.Response, "form1");
+			fr.Controls.Add ("__EVENTTARGET");
+			fr.Controls.Add ("__EVENTARGUMENT");
+			fr.Controls.Add ("GridView1$ctl02$Name");
+			fr.Controls.Add ("GridView1$ctl03$Name");
+			fr.Controls ["__EVENTTARGET"].Value = "GridView1$ctl02$b1";
+			fr.Controls ["__EVENTARGUMENT"].Value = "";
+			fr.Controls ["GridView1$ctl02$Name"].Value = "ABC";
+			fr.Controls ["GridView1$ctl03$Name"].Value = "123";
+			t.Request = fr;
+			t.Invoker = PageInvoker.CreateOnLoad (GridView_postback);
+			pageHTML = HtmlDiff.GetControlFromPageHtml (t.Run ());
+			#region original
+			original = @"<div>
+	<table cellspacing=""0"" rules=""all"" border=""1"" id=""GridView1"" style=""border-collapse:collapse;"">
+		<tr>
+			<th scope=""col"">ID</th><th scope=""col"">&nbsp;</th>
+		</tr><tr>
+			<td>1</td><td>
+                        <input name=""GridView1$ctl02$Name"" type=""text"" value=""ABC"" id=""GridView1_ctl02_Name"" />
+                        <input type=""button"" name=""GridView1$ctl02$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl02$b1','')"" id=""GridView1_ctl02_b1"" />
+                    </td>
+		</tr><tr>
+			<td>2</td><td>
+                        <input name=""GridView1$ctl03$Name"" type=""text"" value=""heh2"" id=""GridView1_ctl03_Name"" />
+                        <input type=""button"" name=""GridView1$ctl03$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl03$b1','')"" id=""GridView1_ctl03_b1"" />
+                    </td>
+		</tr>
+	</table>
+</div>";
+
+			#endregion
+			HtmlDiff.AssertAreEqual (original, pageHTML, "GridViewUpdate #2");
+
+			fr = new FormRequest (t.Response, "form1");
+			fr.Controls.Add ("__EVENTTARGET");
+			fr.Controls.Add ("__EVENTARGUMENT");
+			fr.Controls.Add ("GridView1$ctl02$Name");
+			fr.Controls.Add ("GridView1$ctl03$Name");
+			fr.Controls ["__EVENTTARGET"].Value = "GridView1$ctl03$b1";
+			fr.Controls ["__EVENTARGUMENT"].Value = "";
+			fr.Controls ["GridView1$ctl02$Name"].Value = "ABC";
+			fr.Controls ["GridView1$ctl03$Name"].Value = "123";
+			t.Request = fr;
+			t.Invoker = PageInvoker.CreateOnLoad (GridView_postback);
+			pageHTML = HtmlDiff.GetControlFromPageHtml (t.Run ());
+			#region original
+			original = @"<div>
+	<table cellspacing=""0"" rules=""all"" border=""1"" id=""GridView1"" style=""border-collapse:collapse;"">
+		<tr>
+			<th scope=""col"">ID</th><th scope=""col"">&nbsp;</th>
+		</tr><tr>
+			<td>1</td><td>
+                        <input name=""GridView1$ctl02$Name"" type=""text"" value=""ABC"" id=""GridView1_ctl02_Name"" />
+                        <input type=""button"" name=""GridView1$ctl02$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl02$b1','')"" id=""GridView1_ctl02_b1"" />
+                    </td>
+		</tr><tr>
+			<td>2</td><td>
+                        <input name=""GridView1$ctl03$Name"" type=""text"" value=""123"" id=""GridView1_ctl03_Name"" />
+                        <input type=""button"" name=""GridView1$ctl03$b1"" value=""upd"" onclick=""javascript:__doPostBack('GridView1$ctl03$b1','')"" id=""GridView1_ctl03_b1"" />
+                    </td>
+		</tr>
+	</table>
+</div>";
+
+			#endregion
+			HtmlDiff.AssertAreEqual (original, pageHTML, "GridViewUpdate #3");
 		}
 
         [TestFixtureTearDown]
@@ -2571,12 +2571,12 @@ namespace MonoTests.System.Web.UI.WebControls
 		public static DataTable Select ()
 		{
 			return ds;
-		}
-
-		public static void Reset ()
-		{
-			ds = CreateDataTable ();
-		}
+		}
+
+		public static void Reset ()
+		{
+			ds = CreateDataTable ();
+		}
 
 		public static DataTable Delete (string ID, string FName, string LName)
 		{
@@ -2653,7 +2653,7 @@ namespace MonoTests.System.Web.UI.WebControls
 
 			aTable.PrimaryKey = new DataColumn[] { aTable.Columns["ID"] };
 			return aTable;
-		}
+		}
 	}
 }
 
@@ -2663,3 +2663,4 @@ namespace MonoTests.System.Web.UI.WebControls
 
 
 
+

+ 10 - 6
mcs/class/System.Web/Test/System.Web.UI.WebControls/LoginTest.cs

@@ -261,7 +261,11 @@ namespace MonoTests.System.Web.UI.WebControls {
 		[TestFixtureSetUp]
 		public void SetUp ()
 		{
+#if VISUAL_STUDIO
+			WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.NoEventValidation.aspx", "NoEventValidation.aspx");
+#else
 			WebTest.CopyResource (GetType (), "NoEventValidation.aspx", "NoEventValidation.aspx");
+#endif
 		}
 #endif
 
@@ -958,9 +962,9 @@ namespace MonoTests.System.Web.UI.WebControls {
 			fr.Controls.Add (GetDecoratedId (html, "LoginButton"));
 			fr.Controls ["__EVENTTARGET"].Value = "";
 			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["Login1:UserName"].Value = "yonik";
-			fr.Controls ["Login1:Password"].Value = "123456";
-			fr.Controls ["Login1:LoginButton"].Value = "Log In";
+			fr.Controls ["Login1$UserName"].Value = "yonik";
+			fr.Controls ["Login1$Password"].Value = "123456";
+			fr.Controls ["Login1$LoginButton"].Value = "Log In";
 			t.Request = fr;
 			t.Run ();
 
@@ -988,9 +992,9 @@ namespace MonoTests.System.Web.UI.WebControls {
 			fr.Controls.Add (GetDecoratedId (html, "LoginButton"));
 			fr.Controls ["__EVENTTARGET"].Value = "";
 			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["Login1:UserName"].Value = "yonik";
-			fr.Controls ["Login1:Password"].Value = "123456";
-			fr.Controls ["Login1:LoginButton"].Value = "Log In";
+			fr.Controls ["Login1$UserName"].Value = "yonik";
+			fr.Controls ["Login1$Password"].Value = "123456";
+			fr.Controls ["Login1$LoginButton"].Value = "Log In";
 			t.Request = fr;
 			t.Run ();
 

+ 10 - 10
mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardTest.cs

@@ -1629,10 +1629,10 @@ namespace MonoTests.System.Web.UI.WebControls
 #else
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("Wizard1:StartNavContainer:CancelButtonButton");
+			fr.Controls.Add ("Wizard1$StartNavContainer$CancelButtonButton");
 			fr.Controls ["__EVENTTARGET"].Value = "";
 			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["Wizard1:StartNavContainer:CancelButtonButton"].Value = "Cancel";
+			fr.Controls ["Wizard1$StartNavContainer$CancelButtonButton"].Value = "Cancel";
 #endif
 			t.Request = fr;
 			html = t.Run ();
@@ -1649,10 +1649,10 @@ namespace MonoTests.System.Web.UI.WebControls
 #else
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("Wizard1:StartNavContainer:StartNextButtonButton");
+			fr.Controls.Add ("Wizard1$StartNavContainer$StartNextButtonButton");
 			fr.Controls["__EVENTTARGET"].Value = "";
 			fr.Controls["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["Wizard1:StartNavContainer:StartNextButtonButton"].Value = "Next";
+			fr.Controls ["Wizard1$StartNavContainer$StartNextButtonButton"].Value = "Next";
 #endif
 			t.Request = fr;
 			html = t.Run ();
@@ -1671,11 +1671,11 @@ namespace MonoTests.System.Web.UI.WebControls
 #else
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("Wizard1:FinishNavContainer:FinishPreviousButtonButton");
+			fr.Controls.Add ("Wizard1$FinishNavContainer$FinishPreviousButtonButton");
 
 			fr.Controls ["__EVENTTARGET"].Value = "";
 			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["Wizard1:FinishNavContainer:FinishPreviousButtonButton"].Value = "Previous";
+			fr.Controls ["Wizard1$FinishNavContainer$FinishPreviousButtonButton"].Value = "Previous";
 #endif
 			t.Request = fr;
 			html = t.Run ();
@@ -1705,10 +1705,10 @@ namespace MonoTests.System.Web.UI.WebControls
 #else
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("Wizard1:StartNavContainer:StartNextButtonButton");
+			fr.Controls.Add ("Wizard1$StartNavContainer$StartNextButtonButton");
 			fr.Controls ["__EVENTTARGET"].Value = "";
 			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["Wizard1:StartNavContainer:StartNextButtonButton"].Value = "Next";
+			fr.Controls ["Wizard1$StartNavContainer$StartNextButtonButton"].Value = "Next";
 #endif
 			t.Request = fr;
 			html = t.Run ();
@@ -1726,10 +1726,10 @@ namespace MonoTests.System.Web.UI.WebControls
 #else
 			fr.Controls.Add ("__EVENTTARGET");
 			fr.Controls.Add ("__EVENTARGUMENT");
-			fr.Controls.Add ("Wizard1:FinishNavContainer:FinishButtonButton");
+			fr.Controls.Add ("Wizard1$FinishNavContainer$FinishButtonButton");
 			fr.Controls ["__EVENTTARGET"].Value = "";
 			fr.Controls ["__EVENTARGUMENT"].Value = "";
-			fr.Controls ["Wizard1:FinishNavContainer:FinishButtonButton"].Value = "Finish";
+			fr.Controls ["Wizard1$FinishNavContainer$FinishButtonButton"].Value = "Finish";
 #endif
 			t.Request = fr;
 			t.Run ();

+ 48 - 1
mcs/class/System.Web/Test/System.Web.UI/ControlTest.cs

@@ -121,6 +121,26 @@ namespace MonoTests.System.Web.UI
 			Assert.IsTrue (-1 != control.UniqueID.IndexOfAny (new char[] { ':', '$' }), "separator");
 		}
 
+		[Test]
+		public void ClientID () 
+		{
+			// NC in control
+			Control control = new Control ();
+			Control nc = new MyNC ();
+			Control nc2 = new MyNC ();
+			Control nc3 = new MyNC ();
+
+			nc3.Controls.Add (nc2);
+			nc2.Controls.Add (nc);
+			nc.Controls.Add (control);
+#if NET_2_0
+			string expected = "ctl00_ctl00_ctl00";
+#else
+			string expected = "_ctl0__ctl0__ctl0";
+#endif
+			Assert.AreEqual (expected, control.ClientID, "ClientID");
+		}
+
 		// From bug #76919: Control uses _controls instead of
 		// Controls when RenderChildren is called.
 		[Test]
@@ -164,7 +184,7 @@ namespace MonoTests.System.Web.UI
 		[Category ("NunitWeb")]
 		public void ApplyStyleSheetSkin_1 ()
 		{
-#if DOT_NET
+#if VISUAL_STUDIO
 			WebTest.CopyResource (GetType (), "MonoTests.System.Web.UI.WebControls.Resources.Theme2.skin", "App_Themes/Theme2/Theme2.skin");
 #else
 			WebTest.CopyResource (GetType (), "Theme2.skin", "App_Themes/Theme2/Theme2.skin");
@@ -669,6 +689,17 @@ namespace MonoTests.System.Web.UI
 			Assert.AreEqual (null, ctr.Adapter (), "Adapter");
 		}
 #endif
+		[Test]
+		public void ChildControlsCreated () {
+			ChildControlsCreatedControl ctr = new ChildControlsCreatedControl ();
+			ctr.Controls.Add (new Control ());
+			//ctr.DoEnsureChildControls ();
+
+			Assert.AreEqual (1, ctr.Controls.Count, "ChildControlsCreated#1");
+			ctr.SetChildControlsCreated (false);
+			Assert.AreEqual (1, ctr.Controls.Count, "ChildControlsCreated#2");
+		}
+
 #if NET_2_0
 		[TestFixtureTearDown]
 		public void Tear_down ()
@@ -850,8 +881,24 @@ namespace MonoTests.System.Web.UI
 	{
 	}
 #endif
+
+	public class ChildControlsCreatedControl : Control
+	{
+		protected override void CreateChildControls () {
+			Controls.Add (new Control ());
+		}
+
+		public void DoEnsureChildControls () {
+			EnsureChildControls ();
+		}
+
+		public void SetChildControlsCreated (bool value) {
+			ChildControlsCreated = value;
+		}
+	}
 }
 
 
 
 
+