[Mono-bugs] [Bug 47865][Wis] New - Enable\ Disable bug (Fix provided, including diff)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 25 Aug 2003 02:14:19 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by yaronshkop@hotmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=47865

--- shadow/47865	2003-08-25 02:14:19.000000000 -0400
+++ shadow/47865.tmp.5643	2003-08-25 02:14:19.000000000 -0400
@@ -0,0 +1,94 @@
+Bug#: 47865
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: yaronshkop@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Enable\ Disable bug (Fix provided, including diff)
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+
+Description of Problem:
+The enabled status (Enable\ Disable) of WebControls can not be changed by 
+the user after the first change.
+
+Steps to reproduce the problem:
+1. Open the attached .aspx file
+2. Click the button “Change Enable” on the web form twice.
+
+Actual Results:
+The button “Test” becomes disable after the first click and can not be 
+changed afterwards.
+
+Expected Results:
+The button “Test” enable status should be toggled at every click. 
+(Disabled-Enabled-Disabled…)  
+
+How often does this happen?
+Always.
+
+Fix details:
+As seen in the diff file, the variable enabled is saved into ViewState at 
+SaveViewState method and Loaded from ViewState at the LoadViewState method.
+
+Additional Information: (Tes case - Attached as aspx also)
+<HTML>
+            <HEAD>
+            <script language=C# runat=server>
+            private void Button1_Click(object sender, System.EventArgs e)
+            {
+                 BtnTest.Enabled = !BtnTest.Enabled;
+            }
+            </script>
+            </HEAD>
+            <body MS_POSITIONING="GridLayout">
+                 <form id="Form1" method="post" runat="server">
+                      <asp:Button id="BtnTest" style="Z-INDEX:
+                           LEFT:232px; POSITION: absolute; TOP: 48px" 
+                           runat="server" Text="Test"></asp:Button>
+                      <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 
+                           224px; POSITION: absolute; TOP: 88px"  
+                           runat="server" Text="Enable" 
+                           OnClick="Button1_Click"></asp:Button>
+                 </form>
+            </body>
+</HTML>
+
+ 
+Diff (Attached as file also)
+--- C:\Old\System.Web\System.Web.UI.WebControls\WebControl.cs	2003-08-20 
+11:50:06.000000000 +0300
++++ C:\New\System.Web\System.Web.UI.WebControls\WebControl.cs	2003-08-20 
+18:27:47.045867100 +0300
+@@ -438,6 +438,9 @@
+ 
+ 			if (attributeState != null)
+ 				attributeState.LoadViewState (saved.Third);
++
++			if( ViewState["Enabled"] != null)
++				enabled = (bool)ViewState["Enabled"];
+ 		}
+ 
+ 		protected override void Render(HtmlTextWriter writer)
+
+@@ -454,6 +457,8 @@
+ 
+ 		protected override object SaveViewState()
+ 		{
++			ViewState["Enabled"] = enabled;
++
+ 			object controlView = null;
+ 			if (ControlStyleCreated)
+ 				controlView = ControlStyle.SaveViewState 
+();