|
 |
asp_databases thread: Dynamic Combo Box
Message #1 by Farid Attamimy <Farid.Attamimy@a...> on Thu, 4 May 2000 10:19:03 +0700
|
|
Friends...,
How do I make a dynamic select/combo box ...?
There are 2 select/combo box which the second select/combo box option data
is depend on the first one ....
The data source for both of combo boxes are retrieve from SQL Server (using
ADO)
Is anybody have a sample code ..?
Regards,
Farid Attamimy
Message #2 by "Jacob Horner" <jhorner@b...> on Thu, 4 May 2000 10:05:18 -0400
|
|
Try this: http://www.atgconsulting.com/triplelist.asp. There is code
there for 2 and 3 linked boxes. Good luck.
-Jake
----- Original Message -----
From: Farid Attamimy
To: ASP Databases
Sent: Wednesday, May 03, 2000 11:19 PM
Subject: [asp_databases] Dynamic Combo Box
Friends...,
How do I make a dynamic select/combo box ...?
There are 2 select/combo box which the second select/combo box option data
is depend on the first one ....
The data source for both of combo boxes are retrieve from SQL Server (using
ADO)
Is anybody have a sample code ..?
Regards,
Farid Attamimy
Message #3 by Kevin D Riggs <kevin.riggs@p...> on Thu, 04 May 2000 10:21:26 -0400
|
|
You have to set your Response.Buffer = True before you write the
<head></head> tags. Then using javascript/vbscript to watch for changes in
one of the dropdown boxes. Example code follows:
>>>>>>>>>>>>Begin code<<<<<<<<<<<<<<<
<%
Response.Buffer = True
%>
<head>
<title . . </title>
<script language='javascript'>
function dynamicSelect()
{
n = document.forms[0].dropdown_one.selectedIndex;
document.location = "thispage.asp?firstbox=" +
document.forms[0].dropdown_one(n).value;
return true;
}
</script>
</head>
blah \
blah | HTML code
blah /
<form method='post' action='whatever.asp'>
<select name='dropdown_one' onChange='return dynamicSelect()'>
<%
Dim cmdData, recData
Set cmdData = Server.CreateObject("ADODB.Command")
Set recData = Server.CreateObject("ADODB.Recordset")
cmdData.ActiveConnection = "DSN=database_dsn;"
cmdData.CommandText = "SELECT table_key, record_name FROM database_table
WHERE criteria = '" & varCriteria & "'"
Set recData = cmdData.Execute
While Not recData.EOF
Response.Write "<option value='" & recData("table_key") & "'>" &
recData("record_name") & "</option>"
recData.MoveNext
Wend
%>
</select>
<select name='dropdown_two'>
<%
cmdData.CommandText = "SELECT * FROM second_database_table WHERE
criteria='" & Request.Querystring("firstbox") & "'"
Set recData cmdData.Execute
While Not recData.EOF
Response.Write "<option value='" & recData("table_key") & "'>" &
recData("record_name") & "</option>"
recData.MoveNext
Wend
%>
</select>
>>>>>>>>>>>>>>>>>>>End
Code<<<<<<<<<<<<<<<<<<<<<<
This will dynamically fill the first drop down box and when a user selects
something from the first dropdown box, the form will reload and the second
dropdown box will be fill based on the criteria selected in the second box.
Notice that we reuse the cmdData and recData server objects. This doesn't
hurt anything and it reduces the resource load on the server.
KD
Kevin D Riggs
kevin.riggs@p...
Senior Network Administrator & Webmaster
Rhea County
Board of Education
http://www.rhea.k12.tn.us/
http://www.rheacounty.org/
Message #4 by "Shawn Steward" <ssteward@a...> on Thu, 4 May 2000 17:44:40
|
|
There's a couple of good articles on how to do this without reloading the
page on www.asptoday.com.
<a href="http://www.asptoday.com/articles/20000414.htm">Dynamic Selection
Lists</a>
<a href="http://www.asptoday.com/articles/20000418.htm">An Alternative
Approach to Creating Dynamic Selection Lists</a>
Shawn
On 05/04/00, Farid Attamimy wrote:
> Friends...,
>
> How do I make a dynamic select/combo box ...?
> There are 2 select/combo box which the second select/combo box option data
> is depend on the first one ....
> The data source for both of combo boxes are retrieve from SQL Server (using
> ADO)
>
> Is anybody have a sample code ..?
>
> Regards,
>
> Farid Attamimy
Message #5 by "Shawn Steward" <ssteward@a...> on Thu, 4 May 2000 18:10:48
|
|
Whoops, guess this doesn't read HTML. ;-D
On 05/04/00, "Shawn Steward" wrote:
> There's a couple of good articles on how to do this without reloading the
page on www.asptoday.com.
<a href="http://www.asptoday.com/articles/20000414.htm">Dynamic Selection
Lists</a>
<a href="http://www.asptoday.com/articles/20000418.htm">An Alternative
Approach to Creating Dynamic Selection Lists</a>
Shawn
On 05/04/00, Farid Attamimy wrote:
> Friends...,
>
> How do I make a dynamic select/combo box ...?
> There are 2 select/combo box which the second select/combo box option data
> is depend on the first one ....
> The data source for both of combo boxes are retrieve from SQL Server (using
> ADO)
>
> Is anybody have a sample code ..?
>
> Regards,
>
> Farid Attamimy
Message #6 by "Matthew Lohr" <mlohr@t...> on Thu, 4 May 2000 13:11:44 -0400
|
|
I have an example at http://216.50.69.82/lacrosse/teams/teamselect.asp If
you like it I can send you the code
-----Original Message-----
From: Shawn Steward
Sent: Thursday, May 04, 2000 5:45 PM
To: ASP Databases
Subject: [asp_databases] Re: Dynamic Combo Box
There's a couple of good articles on how to do this without reloading the
page on www.asptoday.com.
<a href="http://www.asptoday.com/articles/20000414.htm">Dynamic Selection
Lists</a>
<a href="http://www.asptoday.com/articles/20000418.htm">An Alternative
Approach to Creating Dynamic Selection Lists</a>
Shawn
On 05/04/00, Farid Attamimy wrote:
> Friends...,
>
> How do I make a dynamic select/combo box ...?
> There are 2 select/combo box which the second select/combo box option data
> is depend on the first one ....
> The data source for both of combo boxes are retrieve from SQL Server
(using
> ADO)
>
> Is anybody have a sample code ..?
>
> Regards,
>
> Farid Attamimy
---
You are currently subscribed to asp_databases
Message #7 by "Abhijit" <natuu@h...> on Fri, 5 May 2000 10:26:48 +0530
|
|
Hi,
Dynamic combo box is quite possible with the element u wanted get selected.
E.g
I have 5 fields in database in to be filled into option list.
Then there is function called
function GenerateDynamicOption(rs)' Rs is a recordset object u wanted
dim str,i
str="<Select name=filldyna>"
i=1
for each item in rs.fields
str=str&"<option "value="& item.value&">"&item.value&"</option>"
i=i + 1
next
str="</select>"
GenerateDynamicOption=str
end function
Abhijit Natu
----- Original Message -----
From: Farid Attamimy
To: ASP Databases <asp_databases@p...>
Sent: Thursday, May 04, 2000 8:49 AM
Subject: [asp_databases] Dynamic Combo Box
>
> Friends...,
>
> How do I make a dynamic select/combo box ...?
> There are 2 select/combo box which the second select/combo box option data
> is depend on the first one ....
> The data source for both of combo boxes are retrieve from SQL Server
(using
> ADO)
>
> Is anybody have a sample code ..?
>
> Regards,
>
> Farid Attamimy
>
Message #8 by Daniel Walker <danielw@w...> on Fri, 5 May 2000 13:25:22 +0100
|
|
No, which is fortunate, really, since it would interpret any other HTML you
included in your messages, as well... which could lead to some pretty
amusing, if not downright alarming(!) messages in cases where people have
included code that they're having problems with. Funny enough, HTML _is_
interpreted on the form that I use to moderate the massages with, so I
frequently end up with a page scattered with enormous words in Comic Sans,
and large, fairly randomly distributed blocks of colour and combo boxes,
etc. When I hit the Approve button, it always comes through as sweet little
blocks or neatly aligned script, however (except in cases where people have
submitted messages in rich text, MIME format, in notepad attachments, etc.
Please don't do this, your code is likely to get mangled and someone's
likely to write in and tell you that it doesn't work because you've randomly
scattered =3D and =20, and stuff throughout it. In some cases I can see
through the damage and repair it, but since it's not my job to go editing
other people's mails, I'd prefer it if you simply submitted in plain text.)
Daniel Walker
Wrox Press
-----Original Message-----
From: Shawn Steward
Sent: Thursday, May 04, 2000 19:11
To: ASP Databases
Subject: [asp_databases] Re: Dynamic Combo Box
Whoops, guess this doesn't read HTML. ;-D
On 05/04/00, "Shawn Steward" wrote:
> There's a couple of good articles on how to do this without reloading the
page on www.asptoday.com.
<a href="http://www.asptoday.com/articles/20000414.htm">Dynamic Selection
Lists</a>
<a href="http://www.asptoday.com/articles/20000418.htm">An Alternative
Approach to Creating Dynamic Selection Lists</a>
Shawn
On 05/04/00, Farid Attamimy wrote:
> Friends...,
>
> How do I make a dynamic select/combo box ...?
> There are 2 select/combo box which the second select/combo box option data
> is depend on the first one ....
> The data source for both of combo boxes are retrieve from SQL Server
(using
> ADO)
>
> Is anybody have a sample code ..?
>
> Regards,
>
> Farid Attamimy
---
You are currently subscribed to asp_databases
Message #9 by Farid Attamimy <Farid.Attamimy@a...> on Mon, 8 May 2000 15:42:41 +0700
|
|
Hi All,
These sample codes that coming from ASPToday are running well at Netscape
Browser 4.x, but not at Ms. Internet Explorer 4.0 ... why ..?
Any suggestion ....?
Regards,
Farid
-----Original Message-----
From: Shawn Steward
Sent: 05 Mei 2000 00:45
To: ASP Databases
Subject: [asp_databases] Re: Dynamic Combo Box
There's a couple of good articles on how to do this without reloading the
page on www.asptoday.com.
<a href="http://www.asptoday.com/articles/20000414.htm">Dynamic Selection
Lists</a>
<a href="http://www.asptoday.com/articles/20000418.htm">An Alternative
Approach to Creating Dynamic Selection Lists</a>
Shawn
|
|
 |