473,387 Members | 1,534 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,387 software developers and data experts.

Reading dropdown values in ASP

Hi all,

I have an ASP application where I need to not only read the selected item
from a combo box on a web page but also all the options in the combo box.
Can someone point me in the right direction.

I can obviously use request.querystring() or request.form() to get the
selected value but not sure about how to get the options.

TIA
Martin
Mar 29 '07 #1
5 3114
Martin Walke wrote:
Hi all,

I have an ASP application where I need to not only read the selected
item from a combo box on a web page but also all the options in the
combo box. Can someone point me in the right direction.

I can obviously use request.querystring() or request.form() to get the
selected value but not sure about how to get the options.
Obviously, you have to store the values somewhere that is accessible to the
code running on the web server. Possibilities inclued a database, a text
file, an xml file, a session variable, an application variable, or some
combination of the above.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Mar 29 '07 #2
Martin Walke wrote:
Hi all,

I have an ASP application where I need to not only read the selected
item from a combo box on a web page but also all the options in the
combo box. Can someone point me in the right direction.

I can obviously use request.querystring() or request.form() to get the
selected value but not sure about how to get the options.
Oh! One possibility i neglected to mention was to use a hidden field in
the form to store the option values, making them part of the Request.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Mar 29 '07 #3
"Martin Walke" <martin.walke_no_spam@vega_dot_co_dot_ukwrote:
>Hi all,

I have an ASP application where I need to not only read the selected item
from a combo box on a web page but also all the options in the combo box.
Can someone point me in the right direction.

I can obviously use request.querystring() or request.form() to get the
selected value but not sure about how to get the options.
You can't. When the form is submitted, one value is transmitted for a
select group: the "value" attribute of the selected option. Nothing
else is sent.

If you want to know the other options in the select group, you'll have
to do it another way: store them in a database, in the session object,
something like that. And bear in mind, that what's transmitted for the
selected option is not what the user sees, it's the "value" attribute.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov
http://members.cox.net/slatteryt
Mar 29 '07 #4
Thanks Tim. It was as I assumed. As per my comment to Bob, I'll use a hidden
field populated by my validate routine.

Martin
"Tim Slattery" <Sl********@bls.govwrote in message
news:u4********************************@4ax.com...
"Martin Walke" <martin.walke_no_spam@vega_dot_co_dot_ukwrote:
>>Hi all,

I have an ASP application where I need to not only read the selected item
from a combo box on a web page but also all the options in the combo box.
Can someone point me in the right direction.

I can obviously use request.querystring() or request.form() to get the
selected value but not sure about how to get the options.

You can't. When the form is submitted, one value is transmitted for a
select group: the "value" attribute of the selected option. Nothing
else is sent.

If you want to know the other options in the select group, you'll have
to do it another way: store them in a database, in the session object,
something like that. And bear in mind, that what's transmitted for the
selected option is not what the user sees, it's the "value" attribute.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov
http://members.cox.net/slatteryt

Mar 29 '07 #5
Thanks Bob.

My line of thinking was to a hidden field anyway.

I just wondered, although couldn't find any reference to it, whether the
srever could access the data in some sneaky way. Obviously, if I'd thought
it through, that client side data doesn't get transmitted in the Request.

Martin

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:eb**************@TK2MSFTNGP05.phx.gbl...
Martin Walke wrote:
>Hi all,

I have an ASP application where I need to not only read the selected
item from a combo box on a web page but also all the options in the
combo box. Can someone point me in the right direction.

I can obviously use request.querystring() or request.form() to get the
selected value but not sure about how to get the options.
Oh! One possibility i neglected to mention was to use a hidden field in
the form to store the option values, making them part of the Request.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Mar 29 '07 #6

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

Similar topics

1
by: news | last post by:
Hello, I need help with the following problem: An HTML page that have two dropdown list whit different values: 1. Dropdown list 1(tblname1) =values with different location's. After user...
6
by: | last post by:
Do you have to use AutoPostBack to read the selected value in a dropdown list? I have an asp.net dropdown on a form. I'm filling it from a table when the page loads and want to read the value the...
3
by: devNorway | last post by:
I have been struggling with a problem for days now, and searched for related problems and solutions but had no luck. I have two dropdown listboxes where the first is populated in page load and...
0
by: Mike Collins | last post by:
I someone can please help, I am about at an end in trying to figure this out. I am adding some dynamic controls to my page (I found out that I was supposed to be doing that in the oninit event,...
0
by: Kay | last post by:
Hello, I have written my own custom control and I want one of its properties to display as a dropdown list when clicked, so the user can select from the list, it would be similar to the asp...
0
by: Kay O'Keeffe | last post by:
Hello, I have written my own custom control and I want one of its properties to display as a dropdown list when clicked, so the user can select from the list, it would be similar to the asp...
6
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList...
5
by: Kassad | last post by:
Two questions: 1. There is a dropdown box that has a whole bunch of values but it is not linked to a recordsource. I believe when this object was created the values were manually enterred but I...
3
by: John | last post by:
I have two dropdown lists that I have bound to a datatable and set the DataTextField and DataValueField for. Both lists show the values I expect from the database. However, when I need to access...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.