[Mono-bugs] [Bug 79309][Nor] Changed - The PostBack method does not work on the DropDownList if selected the first item
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Sep 7 14:10:46 EDT 2006
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 tonyxgu at yahoo.com.
http://bugzilla.ximian.com/show_bug.cgi?id=79309
--- shadow/79309 2006-09-07 04:49:52.000000000 -0400
+++ shadow/79309.tmp.15380 2006-09-07 14:10:46.000000000 -0400
@@ -102,6 +102,42 @@
Please give the screen shot with the result message "Your selected
index is 0". It has never happened to me.
------- Additional Comments From robertj at gmx.net 2006-09-07 04:49 -------
Which Mono version are you testing on?
+
+------- Additional Comments From tonyxgu at yahoo.com 2006-09-07 14:10 -------
+I tried version 1.1.13.8, 1.1.14, 1.1.15, 1.1.16.1, 1.1.17. I am not
+able to test on 1.1.17.1 yet, because when I install the window
+version of 1.1.17.1 to load this page I got the Exception(not
+related this bug).
+Anyway, I download the source code of 1.1.17 on Linux (RedHat 9).
+And looked into the file
+mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs on
+method LoadPostData:
+ 198 bool LoadPostData (string postDataKey,
+NameValueCollection postCollection)
+ 199 {
+ 200 int index;
+ 201
+ 202 index = Items.IndexOf(postCollection
+[postDataKey]);
+ 203 if (index != this.SelectedIndex) {
+ 204 SelectedIndex = index;
+ 205 return true;
+ 206 }
+ 207
+ 208 return false;
+ 209 }
+
+When the first item RE-selected, the index will be 0 on line 202,
+but this.SelectedIndex is 0 too, so the logic on line 203 will
+return false. That is why the PostBack custom method never called.
+
+I am not sure if this.SelectedIndex should return -1 instead 0 or
+add the additional logic for the first item.
+The workaround in my project now is to change the logic on line 203
+as:
+if ( index != this.SelectedIndex || index == 0 ) {
+
+
More information about the mono-bugs
mailing list