473,395 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem with html Select control in postbacks

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
Nov 19 '05 #1
2 1282
dee <de*@home.net> ha scritto:
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
Nov 19 '05 #2
dee
Thanks

"Andrea Zani" <an****@aspitalia.com> wrote in message
news:6N********************@twister1.libero.it...
dee <de*@home.net> ha scritto:
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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mca | last post by:
Hi everyone, I'm new to asp.net and i have a question about separating the html code from the programming code. i have an unknown numbers of entries in my table. I want to make a hyperlink...
0
by: Lucas, Todd | last post by:
Hello everyone! I'm having a problem with a WebControl that I'm designing for a Menu. I've been at it for about 3 weeks now, and can't seem to get around this problem. So I'm hoping that someone...
9
by: Matt Tapia | last post by:
I having a problem that receives the following error: Specified cast is not valid And I need some help. Here is what is happening: I have a form with a drop-down control that contains a list...
2
by: Ralph Krausse | last post by:
I know more html is needed to really produce this but enough is here for me to ask my question. So, this HTML code produce 2 buttons. One button is a HTML control and the other is ASP Web or Server...
0
by: Chris | last post by:
Ok, I think this is an easy one - I've just been staring at it too long. I'm creating a datagrid in asp.net/c# from scratch, i.e. nothing at all in the aspx page. I'm also creating all the...
7
by: arun | last post by:
Hi I am making a booking for a tour. The tours are allowed on some days only( one on monday, other on tuesday like that). For the booking object saving, I am using a wizrd control. In the...
1
by: Nathan Sokalski | last post by:
As we all know, the Calendar control causes postbacks that we often do not want. This will obviously cause the Page's Load event to be triggered. I have code in my Load event that I want executed...
4
by: ma | last post by:
Hello, I have a GrideView that has 4 col. 3 of them are bound to a dataset and the last one is not. The last one is check box. The check box is defined as follow: <asp:TemplateField...
0
by: cmrhema | last post by:
Hi, I have two controls one html select control and one asp.net dropdownlist control. In html select control i have three maps loaded. It is loaded in the following manner. <SELECT...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.