Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
maintaining Select Value.
Old 08-15-2005, 12:21 PM maintaining Select Value.
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Hi

I have a <select> defined in a form.

My question is , how do I maintain the value of the select after my button has been pressed.

if was a input field, the value would be maintained using value='request.form(select)' but htis is not possible witha select.

cheers.

Steve
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 08-15-2005, 12:41 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
you would have your option values in a array and response.write them on with a loop and check each value as the loop iterates.

Code:
<%
dim value_array(3)
value_array(0) = "zero"
value_array(1) = "one"
value_array(2) = "two"
value_array(3) = "three"

<select ... >
<%
with response
for i = 0 to ubound(value_array)
  .write "<option value="
  .write chr(34)
  .write value_array(i)
  .write chr(34)
if value_array(i) = select_value then
  .write " selected ="
  .write chr(34)
  .write "selected"
  .write chr(34)
end if
  .write ">"
  .write value_array(i)
  .write "</option>"
next 
end with

%>
</select>
not tested coded on the fly
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-16-2005, 06:55 AM
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Thats a majorly complicated way of getting the result i want from what I can see. I have done this before using jsp however it was not as complicated as that. The script wasnt specifically Java code either.

cheers for you time though.
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Reply     « Reply to maintaining Select Value.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40582 seconds with 12 queries