2003-06-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 26 Jun 2003 17:53:47 +0000 (17:53 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Thu, 26 Jun 2003 17:53:47 +0000 (17:53 -0000)
* ListControl.cs: save viewstate data when any of the 3 values is not
null. Fixed condition to save selection indices. Closes bug #45493.

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

mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs

index 1a305d8359f584d95a008a48395c25a40a53b8c7..b9b7783bec2e4d9f0e4ec31d409f7ee48442c627 100644 (file)
@@ -1,4 +1,9 @@
 
+2003-06-26  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * ListControl.cs: save viewstate data when any of the 3 values is not
+       null. Fixed condition to save selection indices. Closes bug #45493.
+
 2003-06-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * DataGrid.cs: fixed bug #43823.
index 71d3c276c141bd7269980ffdfa5c556b7f87a74c..1674dde5e8b5146de10c429bf4b1d95c13573812 100644 (file)
@@ -310,12 +310,12 @@ namespace System.Web.UI.WebControls
                        object vs = base.SaveViewState();\r
                        object itemSvs = Items.SaveViewState();\r
                        object indices = null;\r
-                       if(SaveSelectedIndicesViewState)\r
+                       if (SaveSelectedIndicesViewState)\r
                                indices = SelectedIndices;\r
-                       if(vs!= null && itemSvs != null && indices != null)\r
-                       {\r
+\r
+                       if (vs != null || itemSvs != null || indices != null)\r
                                return new Triplet(vs, itemSvs, indices);\r
-                       }\r
+\r
                        return null;\r
                }\r
 \r
@@ -325,15 +325,13 @@ namespace System.Web.UI.WebControls
                        Items.TrackViewState();\r
                }\r
 \r
-               private bool SaveSelectedIndicesViewState\r
-               {\r
-                       get\r
-                       {\r
-                               if( Events[SelectedIndexChangedEvent] != null && Enabled && Visible)\r
-                               {\r
+               private bool SaveSelectedIndicesViewState {\r
+                       get {\r
+                               if (Events[SelectedIndexChangedEvent] == null && Enabled && Visible) {\r
                                        Type t = GetType();\r
                                        // If I am a derivative, let it take of storing the selected indices.\r
-                                       if(t == typeof(DropDownList) || t == typeof(ListBox) || t == typeof(CheckBoxList) || t == typeof(RadioButtonList))\r
+                                       if (t == typeof(DropDownList) || t == typeof(ListBox) ||\r
+                                           t == typeof(CheckBoxList) || t == typeof(RadioButtonList))\r
                                                return false;\r
                                }\r
                                return true;\r