Author: igorz
Date: 2006-11-13 10:46:32 -0500 (Mon, 13 Nov 2006)
New Revision: 67761

Modified:
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
   trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
   
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CompositeDataBoundControlTest.cs
Log:
2006-11-13 Igor Zelmanovich <[EMAIL PROTECTED]>

        * CompositeDataBoundControl.cs: fixed: 
        DataBind sets ChildControlsCreated=true.



Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-11-13 15:44:19 UTC (rev 67760)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2006-11-13 15:46:32 UTC (rev 67761)
@@ -1,3 +1,8 @@
+2006-11-13 Igor Zelmanovich <[EMAIL PROTECTED]>
+
+       * CompositeDataBoundControl.cs: fixed: 
+       DataBind sets ChildControlsCreated=true.
+
 2006-11-13  Vladimir Krasnov  <[EMAIL PROTECTED]>
 
        * Login.cs: fixed CreateChildControls, throws exception if needed

Modified: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
   2006-11-13 15:44:19 UTC (rev 67760)
+++ 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/CompositeDataBoundControl.cs
   2006-11-13 15:46:32 UTC (rev 67761)
@@ -64,6 +64,7 @@
                
                protected internal override void PerformDataBinding 
(IEnumerable data)
                {
+                       ChildControlsCreated = true;
                        ViewState ["_ItemCount"] = CreateChildControls (data, 
true);
                }
                

Modified: trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog 
2006-11-13 15:44:19 UTC (rev 67760)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/ChangeLog 
2006-11-13 15:46:32 UTC (rev 67761)
@@ -1,3 +1,7 @@
+2006-11-13  Igor Zelmanovich   <[EMAIL PROTECTED]>
+
+       * CompositeDataBoundControlTest.cs: added tests.
+
 2006-11-13  Vladimir Krasnov  <[EMAIL PROTECTED]>
 
        * WizardTest.cs: removed NotWorking attributes,

Modified: 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CompositeDataBoundControlTest.cs
===================================================================
--- 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CompositeDataBoundControlTest.cs
  2006-11-13 15:44:19 UTC (rev 67760)
+++ 
trunk/mcs/class/System.Web/Test/System.Web.UI.WebControls/CompositeDataBoundControlTest.cs
  2006-11-13 15:46:32 UTC (rev 67761)
@@ -35,98 +35,115 @@
 using System.Globalization;
 using System.Web;
 using System.Web.UI;
-using System.Web.UI.WebControls;
+using System.Web.UI.WebControls;
 using System.Collections;
 
 namespace MonoTests.System.Web.UI.WebControls
 {
-       [TestFixture]
-       public class CompositeDataBoundControlTest
-       {
-               class MyCompositeDataBoundControl : CompositeDataBoundControl
-               {
-                       public bool ensureDataBound = false;
-                       public bool ensureCreateChildControls = false;
-                       public bool createChildControls1 = false;
-                       public bool createChildControls2 = false;
-                       public bool dataBind = false;
-
-                       protected override int CreateChildControls (IEnumerable 
dataSource, bool dataBinding) {
-                               createChildControls2 = true;
-                               return 10;
-                       }
-
-                       public void DoEnsureChildControls () {
-                               EnsureChildControls ();
-                       }
-
-                       public void DoCreateChildControls () {
-                               CreateChildControls ();
-                       }
-
-                       public override void DataBind () {
-                               base.DataBind ();
-                               dataBind = true;
-                       }
-
-                       protected override void EnsureDataBound () {
-                               base.EnsureDataBound ();
-                               ensureDataBound = true;
-                       }
-
-                       protected override void EnsureChildControls () {
-                               base.EnsureChildControls ();
-                               ensureCreateChildControls = true;
-                       }
-
-                       protected override void CreateChildControls () {
-                               base.CreateChildControls ();
-                               createChildControls1 = true;
-                       }
-
-                       public bool GetRequiresDataBinding () {
-                               return RequiresDataBinding;
-                       }
-
-                       public void SetRequiresDataBinding (bool value) {
-                               RequiresDataBinding = value;
-                       }
-               }
-
-               [Test]
-               public void DetailsView_EnsureChildControlsFlow () {
-                       MyCompositeDataBoundControl c = new 
MyCompositeDataBoundControl ();
-                       Assert.IsFalse (c.GetRequiresDataBinding());
-                       c.DoEnsureChildControls ();
-                       Assert.IsTrue (c.ensureCreateChildControls);
-                       Assert.IsFalse (c.ensureDataBound);
-                       Assert.IsFalse (c.dataBind);
-                       Assert.IsTrue (c.createChildControls1);
-                       Assert.IsFalse (c.createChildControls2);
-               }
-
-               [Test]
-               public void DetailsView_EnsureChildControlsFlow2 () {
-                       MyCompositeDataBoundControl c = new 
MyCompositeDataBoundControl ();
-                       c.SetRequiresDataBinding (true);
-                       Assert.IsTrue (c.GetRequiresDataBinding ());
-                       c.DoEnsureChildControls ();
-                       Assert.IsTrue (c.ensureCreateChildControls);
-                       Assert.IsTrue (c.ensureDataBound);
-                       Assert.IsFalse (c.dataBind);
-                       Assert.IsTrue (c.createChildControls1);
-                       Assert.IsFalse (c.createChildControls2);
-               }
-
-
-               [Test]
-               public void DetailsView_CreateChildControls_Clear () {
-                       MyCompositeDataBoundControl c = new 
MyCompositeDataBoundControl ();
-                       c.Controls.Add (new WebControl (HtmlTextWriterTag.A));
-                       Assert.AreEqual (1, c.Controls.Count);
-                       c.DoCreateChildControls ();
-                       Assert.AreEqual (0, c.Controls.Count);
-               }
+       [TestFixture]
+       public class CompositeDataBoundControlTest
+       {
+               class MyCompositeDataBoundControl : CompositeDataBoundControl
+               {
+                       public bool ensureDataBound = false;
+                       public bool ensureCreateChildControls = false;
+                       public bool createChildControls1 = false;
+                       public bool createChildControls2 = false;
+                       public bool dataBind = false;
+                       public bool CreateChildControls_ChildControlsCreated;
+
+                       protected override int CreateChildControls (IEnumerable 
dataSource, bool dataBinding) {
+                               createChildControls2 = true;
+                               CreateChildControls_ChildControlsCreated = 
ChildControlsCreated;
+                               return 10;
+                       }
+
+                       public void DoEnsureChildControls () {
+                               EnsureChildControls ();
+                       }
+
+                       public void DoCreateChildControls () {
+                               CreateChildControls ();
+                       }
+
+                       public override void DataBind () {
+                               base.DataBind ();
+                               dataBind = true;
+                       }
+
+                       protected override void EnsureDataBound () {
+                               base.EnsureDataBound ();
+                               ensureDataBound = true;
+                       }
+
+                       protected override void EnsureChildControls () {
+                               base.EnsureChildControls ();
+                               ensureCreateChildControls = true;
+                       }
+
+                       protected override void CreateChildControls () {
+                               base.CreateChildControls ();
+                               createChildControls1 = true;
+                       }
+
+                       public bool GetRequiresDataBinding () {
+                               return RequiresDataBinding;
+                       }
+
+                       public void SetRequiresDataBinding (bool value) {
+                               RequiresDataBinding = value;
+                       }
+
+                       public bool GetChildControlsCreated () {
+                               return ChildControlsCreated;
+                       }
+               }
+
+               [Test]
+               public void DetailsView_EnsureChildControlsFlow () {
+                       MyCompositeDataBoundControl c = new 
MyCompositeDataBoundControl ();
+                       Assert.IsFalse (c.GetRequiresDataBinding());
+                       c.DoEnsureChildControls ();
+                       Assert.IsTrue (c.ensureCreateChildControls);
+                       Assert.IsFalse (c.ensureDataBound);
+                       Assert.IsFalse (c.dataBind);
+                       Assert.IsTrue (c.createChildControls1);
+                       Assert.IsFalse (c.createChildControls2);
+               }
+
+               [Test]
+               public void DetailsView_EnsureChildControlsFlow2 () {
+                       MyCompositeDataBoundControl c = new 
MyCompositeDataBoundControl ();
+                       c.SetRequiresDataBinding (true);
+                       Assert.IsTrue (c.GetRequiresDataBinding ());
+                       c.DoEnsureChildControls ();
+                       Assert.IsTrue (c.ensureCreateChildControls);
+                       Assert.IsTrue (c.ensureDataBound);
+                       Assert.IsFalse (c.dataBind);
+                       Assert.IsTrue (c.createChildControls1);
+                       Assert.IsFalse (c.createChildControls2);
+               }
+
+
+               [Test]
+               public void DetailsView_CreateChildControls_Clear () {
+                       MyCompositeDataBoundControl c = new 
MyCompositeDataBoundControl ();
+                       c.Controls.Add (new WebControl (HtmlTextWriterTag.A));
+                       Assert.AreEqual (1, c.Controls.Count);
+                       c.DoCreateChildControls ();
+                       Assert.AreEqual (0, c.Controls.Count);
+               }
+               
+               [Test]
+               public void DataBind_ChildControlsCreated () {
+                       Page p = new Page ();
+                       MyCompositeDataBoundControl c = new 
MyCompositeDataBoundControl ();
+                       p.Controls.Add (c);
+                       Assert.IsFalse (c.GetChildControlsCreated (), 
"ChildControlsCreated before DataBind");
+                       c.DataBind ();
+                       Assert.IsTrue 
(c.CreateChildControls_ChildControlsCreated, "ChildControlsCreated in 
CreateChildControls");
+                       Assert.IsTrue (c.GetChildControlsCreated (), 
"ChildControlsCreated after DataBind");
+               }
        }
 }
-#endif
\ No newline at end of file
+#endif

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to