Drop Down List - is this normal behaviour?

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.
 
M

Mark Rae

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top