R
rcarboni
When duplicate entries are made to a
System.Web.UI.WebControls.ListBox, the SelectedIndex
returned always refers to the first occurance.
For example:
System.Web.UI.WebControls.ListBox ListBox1;
ListBox1.Items.Add(new ListItem("Item 1"));
ListBox1.Items.Add(new ListItem("Item 2"));
ListBox1.Items.Add(new ListItem("Item 3"));
ListBox1.Items.Add(new ListItem("Item 4"));
ListBox1.Items.Add(new ListItem("Item 2"));
ListBox1.Items.Add(new ListItem("Item 1"));
If you highlight the second occurance of "Item 2",
ListBox1.SelectedIndex is set to the first occurance
of "Item 2" with a value of 1.
Does this mean that you cannot have duplicate entries in a
ListBox? I could not find any info about this in the help.
System.Web.UI.WebControls.ListBox, the SelectedIndex
returned always refers to the first occurance.
For example:
System.Web.UI.WebControls.ListBox ListBox1;
ListBox1.Items.Add(new ListItem("Item 1"));
ListBox1.Items.Add(new ListItem("Item 2"));
ListBox1.Items.Add(new ListItem("Item 3"));
ListBox1.Items.Add(new ListItem("Item 4"));
ListBox1.Items.Add(new ListItem("Item 2"));
ListBox1.Items.Add(new ListItem("Item 1"));
If you highlight the second occurance of "Item 2",
ListBox1.SelectedIndex is set to the first occurance
of "Item 2" with a value of 1.
Does this mean that you cannot have duplicate entries in a
ListBox? I could not find any info about this in the help.