Problem with html Select control in postbacks

D

dee

Hi

I have a form that uses a Select html control. The values for the Options
are not all distinct. when i do a postback the item that is selected from
the previous pick is wrong but it has the correct value. The item turns out
to be the first in the list that has same value as the item chosen.

Here is that section of the page


<SELECT id="cntrl" name="cntrl" runat="server">
<option value="0" selected>excellent</option>
<option value="0">good</option>
<option value="0">not bad</option>
<option value="-10">bad</option>
<option value="-20">aweful</option>
</SELECT>:

So, if the option "good" or "not bad" is clicked the postback view shows
"excellent" as the pick since its the first in the list and has same value,
0 , as others. But if "bad" is chosen postback will show the correct option.


Any help is appreciated.
Dee
 
A

Andrea Zani

dee said:
Here is that section of the page


<SELECT id="cntrl" name="cntrl" runat="server">
<option value="0" selected>excellent</option>
<option value="0">good</option>
<option value="0">not bad</option>
<option value="-10">bad</option>
<option value="-20">aweful</option>
</SELECT>:

So, if the option "good" or "not bad" is clicked the postback view
shows "excellent" as the pick since its the first in the list and has
same value, 0 , as others. But if "bad" is chosen postback will show
the correct option.

Tag select not work corretly with the same value for the value option:
<SELECT id="cntrl" name="cntrl" runat="server">
<option value="20" selected>excellent</option>
<option value="10">good</option>
<option value="0">not bad</option>
<option value="-10">bad</option>
<option value="-20">aweful</option>
</SELECT>:
 
D

dee

Thanks

Andrea Zani said:
dee said:
Here is that section of the page


<SELECT id="cntrl" name="cntrl" runat="server">
<option value="0" selected>excellent</option>
<option value="0">good</option>
<option value="0">not bad</option>
<option value="-10">bad</option>
<option value="-20">aweful</option>
</SELECT>:

So, if the option "good" or "not bad" is clicked the postback view
shows "excellent" as the pick since its the first in the list and has
same value, 0 , as others. But if "bad" is chosen postback will show
the correct option.

Tag select not work corretly with the same value for the value option:
<SELECT id="cntrl" name="cntrl" runat="server">
<option value="20" selected>excellent</option>
<option value="10">good</option>
<option value="0">not bad</option>
<option value="-10">bad</option>
<option value="-20">aweful</option>
</SELECT>:

--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
 

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

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top