Populate Dynamic dropdown box

S

Simon Gare

Hi,

have form on asp page that recalls data from the recordset and populates all
the fields except the dynamic dropdown box that doesn't, just shows default
value. How do I make it populate based on the entry in the db?

Regards
Simon


--
Simon Gare
The Gare Group Limited

website: www.thegaregroup.co.uk
website: www.privatehiresolutions.co.uk
 
B

Bob Barrows [MVP]

Simon said:
Hi,

have form on asp page that recalls data from the recordset and
populates all the fields except the dynamic dropdown box that
doesn't, just shows default value. How do I make it populate based on
the entry in the db?

As you write each option string to Response, compare the string you are
writing as the option's value to the data in the recordset. If They are
the same, write "selected" to response before closing the option's tag.
Otherwise, don't write "selected".
 
S

Simon Gare

Thanks Bob,

Got it

<select name="Access_level" id="select2">
<option value"">Select access level</option>
<option value="1" <% response.write "selected"
%>>Driver</option>
<option value="2" <% response.write "selected" %>>Operator /
Controller</option>
<option value="3" <% response.write "selected"
%>>Administrator</option>
</select>

Worked perfectly trying too hard again I was Dim this and Dim that couldnt
get my head around it.

Simon

..
 
S

Simon Gare

Bob,

have a problem, the way I did it hasn't worked should I be doing something
like,

<% if ACCESS_LEVEL(0) = true then response.write "selected" %>

??

Simon
 
B

Bob Barrows [MVP]

Simon said:
Thanks Bob,

Got it

<select name="Access_level" id="select2">
<option value"">Select access level</option>
<option value="1" <% response.write "selected"
%>>Driver</option>
<option value="2" <% response.write "selected"
%>>Operator / Controller</option>
<option value="3" <% response.write "selected"
%>>Administrator</option>
</select>

Worked perfectly trying too hard again I was Dim this and Dim that
couldnt get my head around it.

Simon

That works?? If you say so ...
 
E

Evertjan.

Simon Gare wrote on 26 feb 2007 in
microsoft.public.inetserver.asp.general:
<select name="Access_level" id="select2">
<option value"">Select access level</option>
<option value="1" <% response.write "selected"
%>>Driver</option>
<option value="2" <% response.write "selected"
%>>Operator /
Controller</option>
<option value="3" <% response.write "selected"
%>>Administrator</option>
</select>

I don't think this is very useful as it just places a selected in each
option, so probably the top one will have an effect.


<%
s = ~numeric result from database~
%>

<select name="Access_level" id="select2">
<option value="">
Select access level</option>
<option value="1" <% if s=1 then response.write "selected" %>>
Driver</option>
<option value="2" <% if s=2 then response.write "selected" %>>
Operator / Controller</option>
<option value="3" <% if s=3 then response.write "selected" %>>
Administrator</option>
</select>
 
B

Bob Barrows [MVP]

Simon said:
Bob,

have a problem, the way I did it hasn't worked should I be doing
something like,

<% if ACCESS_LEVEL(0) = true then response.write "selected" %>

??
Yes, that's more like it. Have you tried it? Does it work? If not, write
the value of ACCESS_LEVEL(0) to Response and show us what it is.
 
S

Simon Gare

it did Bob thanks

<option value="00:10" <% if (AirportStation.Fields.Item("LeadTime").Value) =
("00:10:00") then response.write "selected" %>>10 Mins</option>

Regards
Simon
 

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

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top