Home | Advertising Info66 USERS CURRENTLY ONLINE   
   Site Search Contact Us Friday, March 14, 2025  
 
 


 
ASPProtect
User Management Application with web based screens that allow you to manage users.
www.ASPProtect.com
 
ASPBanner
Banner Rotation system. Advertisers can monitor online statistical reports via their web browsers.
www.ASPBanner.com
 
ASP Photo Gallery
Upload an unlimited amount of albums. Set up categories.Image resizing thumbnail creation.
www.ASPPhotoGallery.com
 
ASPClassifieds
Classifieds system. Set up categories. Users can register themselves. Supports picture uploads.
www.ASPClassifieds.com



DISCUSSION ARCHIVES
 



We didn't realize
the site was so popular.

Other Stuff
 

 
 
Active Server Pages help tutorial how to ASP Help ASP Tutorials ASP Programming ASP Code - ASP Free CJWSoft ASPProtect ASPBanner ASPClassifieds



(Advanced)  (Components)  (Database)  (General)  (Vbscript)




ASPProtect

 
Subject: Re: Dropdown select box
From: Harlan
Date: 3/15/1999 8:49:14 AM
IP: 206.222.20.2



 

I think they go over this somewhere else, but I'll post the code (cuz, I have a projected opened that does it). As for the board, its not mine, but adding what ya asked for wouldn't be hard. ;)


code here..

'----------------------------------------------------------------
' Name: CreateSelect
'----------------------------------------------------------------
' Purpose: Create Select list
' from sql statement
'----------------------------------------------------------------
' Takes:
' selectName the name of the
' select list
' sqlString the sql query to
' create the select.
' optionValue, the field name
' to be used as the options
' value= field
' optionViewable, the field name
' to be used as the options
' viewable field
'----------------------------------------------------------------
' Returns: Nothing
'----------------------------------------------------------------
Sub CreateSelect(selectName, sqlString, optionValue, optionViewable)
'open the database
DBOpen
'open the query
Set rsSelect = DB.Execute(sqlString)
'write out the select
%><SELECT Name='<%=selectName%>'><%
If rsSelect.EOF and rsSelect.BOF then
'what to do if we don't find any.
%><Option Value='-1'>None Found<%
Else
'and if there are some
Do While Not rsSelect.EOF
If rsSelect(optionValue) = Session("select" & selectName) Then
'if it was last selected, select it again.
%><Option Value='<%=rsSelect(optionValue)%>' selected><%=rsSelect(optionViewable)%><%
Else
'if not, don't select it
%><Option Value='<%=rsSelect(optionValue)%>'><%=rsSelect(optionViewable)%><%
End If
'move to the next record
rsSelect.MoveNext
'go threw the loop again
Loop
End If
'close the database
DBClose
'write out the end of the select
%></SELECT><%
End Sub


this is one of the functions in my standard library of includes.. here is how its used:

'dimension variables
dim sqlType
'create query string
sqlType = "Select catagory,typeid from catagories order by catagory"
'create the select list, using functions.inc createSelect
Call CreateSelect("type",sqlType,"typeID","catagory")%>

Previous Message

Follow Up - Re: Dropdown select box - Bruce 3/16/1999 2:41:26 AM


 

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright Š 1998 - 2025 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages ASP ASP.NET .aspx .ascx Web HTML Developer Internet Microsoft Web Services Visual Studio .NET CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com