Drop Down List - is this normal behaviour?

  • Thread starter Thread starter G
  • Start date Start date
G

G

I have the following DropDownList on my webform.

<asp:DropDownList ID="MyStatus" CssClass="DropDownList"
runat="server">
<asp:ListItem Value="" Text="Please select"></asp:ListItem>
<asp:ListItem Value="0" Text="Where's the nearest
bridge?">Where's the nearest bridge?"></asp:ListItem>
<asp:ListItem Value="1" Text="Been better.">Been
better.</asp:ListItem>
<asp:ListItem Value="1" Text="Feeling chirpier than
usual">Feeling chirpier than usual</asp:ListItem>
<asp:ListItem Value="1" Text="Fantastic, Amazing, On top of
the world!">Fantastic, Amazing, On top of the world!"></asp:ListItem>
<asp:ListItem Value="1" Text="Bloody marvelous!">Bloody
marvelous!</asp:ListItem>
<asp:ListItem Value="1" Text="Absolutely
Euphoric">Absolutely Euphoric</asp:ListItem>
</asp:DropDownList>

In code behind, if I try to capture the SelectedText, I am unable to capture
anything other than "Where's the nearest bridge" or "Been better", which is
returned for everything except the first selection.

Does .NET not distinguish between the various drop down options when they
have an identical "value"?

Any advice appreciated.

G.
 
Does .NET not distinguish between the various drop down options when they
have an identical "value"?
No.

Any advice appreciated.

Give each <asp:ListItem> a unique value.
 
Back
Top