473,387 Members | 1,495 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.

Populate Dynamic dropdown box

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
Feb 26 '07 #1
7 3963
Simon Gare wrote:
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".

--
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.
Feb 26 '07 #2
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

..
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:Oh*************@TK2MSFTNGP04.phx.gbl...
Simon Gare wrote:
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".

--
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.


Feb 26 '07 #3
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>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 26 '07 #4
Simon Gare wrote:
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 ...
--
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.
Feb 26 '07 #5
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
"Simon Gare" <si***@simongare.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
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

.
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:Oh*************@TK2MSFTNGP04.phx.gbl...
Simon Gare wrote:
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".

--
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.


Feb 26 '07 #6
Simon Gare wrote:
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.
--
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.
Feb 26 '07 #7
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

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:eB*************@TK2MSFTNGP02.phx.gbl...
Simon Gare wrote:
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.
--
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.


Feb 26 '07 #8

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

Similar topics

1
by: jzhang29 | last post by:
I have a JSP page and it contains a dropdown list called Office. What I try to do is: When I select different office from this list, the information of office (address, phone,etc) will be...
7
by: Jeff Uchtman | last post by:
I know I have done this but my mind is fried. I have a dynamic dropdown in a form. I need to pull both the dynamic dropdown's ID and name listed in the dropdown. Need a little help with grey...
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...
11
by: eureka | last post by:
Hi All, I'm training in Servlets, JSP and JavaScript, I have a web page in which there's a "StudentName" textbox and below it is a "Names" Dropdown list. Initially the Textbox is empty and...
1
by: fran7 | last post by:
Hi, Anyone know how to populate a dropdown list with data from database. I have an interface that generates the following code for names in my database. ..asp <%If Trim(rsCard("Author"))<>""...
1
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
0
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
2
by: FatBear | last post by:
Sorry for cross-posting this to microsoft.public.inetserver.asp.db - I didn't know if that group saw much action. Hi All, I'm very new to ASP and am now working on an existing site that is...
2
by: raamay | last post by:
I want to have a dynamic dropdown box whose entries would depend on the selection of an entry in the first dropdown box. BUT the second dropdown box should not reload, only the entries inside should...
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: 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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.