[Mono-bugs] [Bug 47866][Wis] New - Visible\Invisible bug (Provided fix, including diff)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 25 Aug 2003 02:25:35 -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=47866

--- shadow/47866	2003-08-25 02:25:35.000000000 -0400
+++ shadow/47866.tmp.5741	2003-08-25 02:25:35.000000000 -0400
@@ -0,0 +1,143 @@
+Bug#: 47866
+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: Visible\Invisible bug (Provided fix, including diff)
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+
+Description of Problem:
+The visibility of controls 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 “Visibility change” on the web form twice.
+
+Actual Results:
+The button “Test” becomes invisible after the first click and remains at 
+this status. 
+
+Expected Results:
+The button “Test” visibility should be toggled at every click. (Invisible-
+Visible-Invisible …) 
+
+How often does this happen?
+Always.
+
+Fix details:
+As seen in the diff file, the variable _visible is saved into ViewState at 
+SaveViewState method and Loaded from ViewState at the LoadViewState method.
+
+Additional Information:
+<HTML>
+      <HEAD>
+      <title>WebForm8</title>
+      <script language="C#" runat="server">
+      private void Button1_Click(object sender, System.EventArgs e)
+      {
+           BtnTest.Visible = !BtnTest.Visible;
+      }
+      </script>
+      </HEAD>
+      <body MS_POSITIONING="GridLayout">
+      <form id="Form1" method="post" runat="server">
+           <asp:Button id="BtnTest" style="Z-INDEX: 101; LEFT: 232px; 
+                POSITION: absolute; TOP: 48px" runat="server" 
+                Text="Test"></asp:Button>
+           <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 184px; 
+                POSITION: absolute; TOP: 88px" runat="server" 
+                Text="Visibility Change" 
+                Onlick="Button1_Click"></asp:Button>
+      </form>
+      </body>
+</HTML>
+
+Diff:
+--- C:\Old\System.Web\System.Web.UI\Control.cs	2003-08-20 
+11:50:04.000000000 +0300
++++ C:\New\System.Web\System.Web.UI\Control.cs	2003-08-24 
+15:07:18.276778400 +0300
+@@ -559,11 +559,11 @@
+ 			return namingContainer.FindControl (id, colon + 1);
+
+                 }
+
+ 
+
+-                protected virtual void LoadViewState(object savedState)
+
+-                {
+
+-			if (savedState != null)
+
+-				ViewState.LoadViewState (savedState);
+
+-                }
+
++		protected virtual void LoadViewState(object savedState)
+
++		{
+
++			if (savedState != null)
+			{
++				ViewState.LoadViewState (savedState);
+
+                if(ViewState["Visible"] != null)
+					_visible = (bool)ViewState
+["Visible"];
+
++			}
+		}
+                 
+
+ 		[MonoTODO("Secure?")]
+
+                 protected string MapPathSecure(string virtualPath)
+
+@@ -642,12 +642,7 @@
+                 }
+
+ 		
+
+                 protected virtual object SaveViewState ()
+
+-                {
+
+-			if (_viewState == null)
+
+-				return null;
+
+-
+
+-			return _viewState.SaveViewState ();
+
+-                }
+
++                {
+					if (_viewState == null)
+						return null;
+
+					ViewState["Visible"] = _visible;
+
+					return _viewState.SaveViewState ();
+                }
+
+ 
+
+                 protected virtual void TrackViewState()
+
+                 {