Bullschmidt.com
Home
Web Database Concept
How We Work Together
Bio
Web Database Sample
Classic ASP Design Tips
Bar Chart Tool
Web Design Resources
Access Database Sample
Classic ASP Design Tips
Fill a Listbox Possibly With Multiple Columns
These are opinions of J. Paul Schmidt, MBA.
No warranties are either expressed or implied.
To Use Paul's Services:
Paul@Bullschmidt.com
Dynamically show the results in a listbox possibly with multiple columns based on data in a database.
You can fill listboxes for example to let a user choose a rep in a reps listbox.
View "Fill a Listbox Possibly With Multiple Columns" Sample
Download "Fill a Listbox Possibly With Multiple Columns" Sample
To streamline code on the main page and easily allow many possibilities this uses a custom ASP class called objjpsvbBuildOption which resides in an included page.
Example:
<% ' Set sql.
strSQL = "SELECT UserID "
strSQL = strSQL & "FROM tblUser "
strSQL = strSQL & "ORDER BY UserID"
%>
<select name="UserID" size="1">
<% ' Create, use, destroy object.
Set objjpsvbBuildOption = New jpsvbBuildOption
objjpsvbBuildOption.DefaultValue = UserID
objjpsvbBuildOption.FldWidths = "100"
objjpsvbBuildOption.AddedRowFlds = ""
objjpsvbBuildOption.FldWidthPadding = False
Call objjpsvbBuildOption.Execute(objConn, objRS, strSQL)
Set objjpsvbBuildOption = Nothing
%>
</select>
And to see something like this in action you can do the following:
- Go to
www.bullschmidt.com/login.asp
(the ASP Web database demo's login page)
- Click the Continue button
- On the Main Menu click the Customers Edit button
- On the Customers Edit Search Dialog notice the Rep and Customer listboxes
To Use Paul's Services:
Paul@Bullschmidt.com
Copyright © 2000-2010
J. Paul Schmidt, MBA
Freelance Web and Database Developer
All Rights Reserved
Privacy Policy