Author: kostat
Date: 2006-04-25 03:42:57 -0400 (Tue, 25 Apr 2006)
New Revision: 59836
Modified:
trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI/Control.cs
trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/Test/System.Web.UI/ControlTest.cs
Log:
implementation for IsViewStateEnabled
Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2006-04-25 06:48:23 UTC
(rev 59835)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2006-04-25 07:42:57 UTC
(rev 59836)
@@ -1,3 +1,7 @@
+2006-04-25 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * Control.cs: implementation for IsViewStateEnabled.
+
2006-04-25 Andrew Skiba <[EMAIL PROTECTED]>
* Control.cs: fix null pointer exception
Modified: trunk/mcs/class/System.Web/System.Web.UI/Control.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/Control.cs 2006-04-25 06:48:23 UTC
(rev 59835)
+++ trunk/mcs/class/System.Web/System.Web.UI/Control.cs 2006-04-25 07:42:57 UTC
(rev 59836)
@@ -281,7 +281,14 @@
protected internal bool IsViewStateEnabled
{
get {
- throw new NotImplementedException ();
+ if (Page == null)
+ return false;
+
+ for (Control control = this; control != null;
control = control.Parent)
+ if (!control.EnableViewState)
+ return false;
+
+ return true;
}
}
Modified: trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog 2006-04-25
06:48:23 UTC (rev 59835)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog 2006-04-25
07:42:57 UTC (rev 59836)
@@ -1,3 +1,7 @@
+2006-04-25 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * ControlTest.cs: added test for IsViewStateEnabled.
+
2006-04-25 Andrew Skiba <[EMAIL PROTECTED]>
* ControlTest.cs: added test for ApplyStyleSheetSkin
Modified: trunk/mcs/class/System.Web/Test/System.Web.UI/ControlTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI/ControlTest.cs
2006-04-25 06:48:23 UTC (rev 59835)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI/ControlTest.cs
2006-04-25 07:42:57 UTC (rev 59836)
@@ -130,6 +130,12 @@
public override ControlCollection Controls {
get { return coll; }
}
+
+#if NET_2_0
+ public bool DoIsViewStateEnabled {
+ get { return IsViewStateEnabled; }
+ }
+#endif
}
// From bug #76919: Control uses _controls instead of
@@ -155,6 +161,21 @@
Control c = new Control ();
c.ApplyStyleSheetSkin (p);
}
+
+#if NET_2_0
+ [Test]
+ public void IsViewStateEnabled ()
+ {
+ DerivedControl c = new DerivedControl ();
+ Assert.IsFalse (c.DoIsViewStateEnabled);
+ Page p = new Page ();
+ c.Page = p;
+ p.Controls.Add (c);
+ Assert.IsTrue (c.DoIsViewStateEnabled);
+ p.EnableViewState = false;
+ Assert.IsFalse (c.DoIsViewStateEnabled);
+ }
+#endif
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches