Переглянути джерело

2002-07-08 Gonzalo Paniagua Javier <[email protected]>

	* Control.cs: fixed Visible property.
	* Page.cs: fixed GetViewStateString.

svn path=/trunk/mcs/; revision=5653
Gonzalo Paniagua Javier 23 роки тому
батько
коміт
d2b127ebfa

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

@@ -1,3 +1,8 @@
+2002-07-08  Gonzalo Paniagua Javier <[email protected]>
+
+	* Control.cs: fixed Visible property.
+	* Page.cs: fixed GetViewStateString.
+
 2002-07-05  Gonzalo Paniagua Javier <[email protected]>
 
 	* System.Web.UI/Page.cs:

+ 8 - 2
mcs/class/System.Web/System.Web.UI/Control.cs

@@ -236,10 +236,16 @@ namespace System.Web.UI
                         }
                 }
                 public virtual bool Visible
-                { //TODO: Are children visible when parents are not?
+                {
                         get
                         {
-                                return _visible;
+				if (_visible == false)
+					return false;
+
+				if (_parent != null)
+					return _parent.Visible;
+
+                                return true;
                         }
                         set
                         {

+ 5 - 4
mcs/class/System.Web/System.Web.UI/Page.cs

@@ -356,7 +356,8 @@ public class Page : TemplateControl, IHttpHandler
 		}
 	}
 
-	private bool got_state = false;
+	private bool _got_state = false;
+	private int _random;
 	internal void OnFormRender (HtmlTextWriter writer, string formUniqueID)
 	{
 		if (_hasForm)
@@ -376,13 +377,13 @@ public class Page : TemplateControl, IHttpHandler
 		if (_context != null)
 			state_string.Append (_context.Request.QueryString.GetHashCode ());
 
-		int _random = 0;
-		if (!got_state) {
+		if (!_got_state) {
 			Random rnd = new Random ();
 			_random = rnd.Next ();
 			if (_random < 0)
 				_random = -_random;
 			_random++;
+			_got_state = true;
 		}
 
 		state_string.AppendFormat ("{0:X}", _random);
@@ -454,6 +455,7 @@ public class Page : TemplateControl, IHttpHandler
 			//-- Control execution lifecycle in the docs
 			OnInit (EventArgs.Empty);
 		}
+		_got_state = false;
 		_hasForm = false;
 		_context = context;
 		//LoadViewState ();
@@ -472,7 +474,6 @@ public class Page : TemplateControl, IHttpHandler
 		foreach (Control ctrl in Controls)
 			ctrl.RenderControl (output);
 
-		got_state = false;
 		//SavePageViewState ();
 	}