-/**\r
- * Namespace: System.Web.UI.WebControls\r
- * Class: ListBox\r
- *\r
- * Author: Gaurav Vaish\r
- * Maintainer: gvaish@iitk.ac.in\r
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\r
- * Implementation: yes\r
- * Status: 100%\r
- *\r
- * (C) Gaurav Vaish (2002)\r
- */\r
+//
+// System.Web.UI.WebControls.ListBox.cs
+//
+// Authors:
+// Gaurav Vaish (gvaish@iitk.ac.in)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+//
+// (C) Gaurav Vaish (2002)
+// (C) 2003 Andreas Nahr
+//\r
\r
using System;\r
using System.Drawing;\r
public ListBox () : base ()\r
{\r
}\r
-\r
+
+ [Browsable (false)]\r
public override Color BorderColor\r
{\r
get { return base.BorderColor; }\r
set { base.BorderColor = value; }\r
}\r
-\r
+
+ [Browsable (false)]\r
public override BorderStyle BorderStyle\r
{\r
get { return base.BorderStyle; }\r
set { base.BorderStyle = value; }\r
}\r
-\r
+
+ [Browsable (false)]\r
public override Unit BorderWidth\r
{\r
get { return base.BorderWidth; }\r
set { base.BorderWidth = value; }\r
}\r
-\r
+
+
+ [DefaultValue (4), Bindable (true), WebCategory ("Appearance")]
+ [WebSysDescription ("The number of rows displayed by the control.")]\r
public virtual int Rows\r
{\r
get {\r
\r
set {\r
if (value < 1 || value > 2000)\r
- throw new ArgumentOutOfRangeException ();\r
+ throw new ArgumentOutOfRangeException ("value", "Rows value has to be >= 0 and <= 2000.");\r
\r
ViewState ["Rows"] = value;\r
}\r
}\r
-\r
+
+ [DefaultValue (typeof (ListSelectionMode), "Single"), WebCategory ("Behavior")]
+ [WebSysDescription ("The mode describing how the entries can be selected.")]\r
public virtual ListSelectionMode SelectionMode\r
{\r
get\r
set\r
{\r
if (!Enum.IsDefined (typeof (ListSelectionMode), value))\r
- throw new ArgumentException ();\r
+ throw new ArgumentOutOfRangeException ("value", "Only valid enumeration members are allowed");\r
ViewState ["SelectionMode"] = value;\r
}\r
}\r
-\r
+
+ [Browsable (false), DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Bindable (false), EditorBrowsable (EditorBrowsableState.Never)]\r
public override string ToolTip\r
{\r
get { return String.Empty; }\r
{\r
string[] vals = postCollection.GetValues (postDataKey);\r
bool updated = false;\r
- ArrayList selected = SelectedIndices;\r
- ArrayList final = new ArrayList (vals.Length);\r
if (vals != null){\r
if (SelectionMode == ListSelectionMode.Single){\r
int index = Items.FindByValueInternal (vals [0]);\r
updated = true;\r
}\r
} else {\r
+ ArrayList indices = SelectedIndices;
+ int length = vals.Length;
+ ArrayList final = new ArrayList (length);
foreach (string current in vals)\r
final.Add (Items.FindByValueInternal (current));\r
-\r
- if (selected != null && selected.Count == vals.Length){\r
- for (int ctr = 0; ctr < vals.Length; ctr++){\r
- if (((int) final [ctr]) != ((int) selected [ctr])){\r
+
+ if (indices.Count == length) {
+ for (int ctr = 0; ctr < length; ctr++){
+ if (((int) final [ctr]) != ((int) indices [ctr])){
updated = true;\r
break;\r
}\r
} else {\r
updated = true;\r
}\r
- }\r
- if (!updated)\r
- Select (final);\r
+ if (updated)
+ Select (final);
+ }
} else {\r
if (SelectedIndex != -1)\r
SelectedIndex = -1;\r