Jelajahi Sumber

* Control.cs: Make IsViewStateEnabled available on 1.0 profile
and use it to determine if viewstate needs to be saved instead of
the newly introduced ViewStateShouldBeSaved. Remove
ViewStateShouldBeSaved.

svn path=/trunk/mcs/; revision=126025

Gert Driesen 17 tahun lalu
induk
melakukan
215b9c88cf

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

@@ -1,3 +1,10 @@
+2009-02-06  Gert Driesen  <[email protected]>
+
+	* Control.cs: Make IsViewStateEnabled available on 1.0 profile
+	and use it to determine if viewstate needs to be saved instead of
+	the newly introduced ViewStateShouldBeSaved. Remove
+	ViewStateShouldBeSaved.
+
 2009-02-05  Marek Habersack  <[email protected]>
 
 	* Control.cs: if a control has been added to the controls

+ 11 - 21
mcs/class/System.Web/System.Web.UI/Control.cs

@@ -294,7 +294,15 @@ namespace System.Web.UI
 			get { return _isChildControlStateCleared; }
 		}
 
-		protected internal bool IsViewStateEnabled {
+		protected bool LoadViewStateByID {
+			get { return false; }
+		}
+#endif
+
+#if NET_2_0
+		protected internal
+#endif
+		bool IsViewStateEnabled {
 			get {
 				for (Control control = this; control != null; control = control.Parent)
 					if (!control.EnableViewState)
@@ -304,10 +312,7 @@ namespace System.Web.UI
 			}
 		}
 
-		protected bool LoadViewStateByID {
-			get { return false; }
-		}
-
+#if NET_2_0
 		protected char IdSeparator {
 			get { return '$'; }
 		}
@@ -1589,21 +1594,6 @@ namespace System.Web.UI
 #endif
 		}
 
-		bool ViewStateShouldBeSaved ()
-		{
-			if (!EnableViewState)
-				return false;
-
-			Control parent = Parent;
-			while (parent != null) {
-				if (!parent.EnableViewState)
-					return false;
-				parent = parent.Parent;
-			}
-
-			return true;
-		}
-		
 		internal object SaveViewStateRecursive ()
 		{
 			TraceContext trace = (Context != null && Context.Trace.IsEnabled) ? Context.Trace : null;
@@ -1645,7 +1635,7 @@ namespace System.Web.UI
 #endif
 			object thisState = null;
 
-			if (ViewStateShouldBeSaved ())
+			if (IsViewStateEnabled)
 				thisState = SaveViewState ();
 
 			if (thisState == null && controlList == null && controlStates == null) {