Ver código fonte

2003-09-27 Gonzalo Paniagua Javier <[email protected]>

	* CheckBox.cs: render the 'disabled' attribute in the correct tag.
	* WebControl.cs: fixed Enabled property and save it in ViewState.

	Fixes bug #48802.

svn path=/trunk/mcs/; revision=18323
Gonzalo Paniagua Javier 22 anos atrás
pai
commit
7f3cbdbc8d

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

@@ -1,3 +1,10 @@
+2003-09-27  Gonzalo Paniagua Javier <[email protected]>
+
+	* CheckBox.cs: render the 'disabled' attribute in the correct tag.
+	* WebControl.cs: fixed Enabled property and save it in ViewState.
+
+	Fixes bug #48802.
+
 2003-09-21  Gonzalo Paniagua Javier <[email protected]>
 
 	* ListControl.cs: fixed bug #48668. Thanks to Yaron Shkop.

+ 3 - 5
mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs

@@ -133,11 +133,6 @@ namespace System.Web.UI.WebControls
 				ControlStyle.AddAttributesToRender (writer, this);
 			}
 
-			if (!Enabled){
-				hasBeginRendering = true;
-				writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
-			}
-
 			if (ToolTip.Length > 0){
 				hasBeginRendering = true;
 				writer.AddAttribute (HtmlTextWriterAttribute.Title, ToolTip);
@@ -178,6 +173,9 @@ namespace System.Web.UI.WebControls
 		
 		internal virtual void RenderInputTag (HtmlTextWriter writer, string clientId)
 		{
+			if (!Enabled)
+				writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+
 			writer.AddAttribute (HtmlTextWriterAttribute.Id, clientId);
 			writer.AddAttribute( HtmlTextWriterAttribute.Type, "checkbox");
 			writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);

+ 11 - 1
mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs

@@ -196,7 +196,16 @@ namespace System.Web.UI.WebControls
 		[DefaultValue (true), Bindable (true), WebCategory ("Behavior")]
 		[WebSysDescription ("The activation state of this WebControl.")]
 		public virtual bool Enabled {
-			get { return enabled; }
+			get {
+				if (!enabled)
+					return false;
+
+				WebControl parent = Parent as WebControl;
+				if (parent != null)
+					return ((WebControl) parent).Enabled;
+					
+				return true;
+			}
 			set {
 				if (enabled != value)
 					ViewState ["Enabled"] = value;
@@ -444,6 +453,7 @@ namespace System.Web.UI.WebControls
 			if (ControlStyleCreated)
 				controlView = ControlStyle.SaveViewState ();
 
+			ViewState ["Enabled"] = enabled;
 			object baseView = base.SaveViewState ();
 			object attrView = null;
 			if (attributeState != null)