magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 2000 > 04 > Script Junkie  

Scripting Select Boxes with ASP

By Alan Smithy

Most Web sites use at least one set of isolated, normalized data, and possibly dozens of sets. A set can be any list of infrequently changing data—lists of states, countries, vendors, colors, sizes, or shapes.

Whatever the actual data may be, its existence (perhaps in a database) and its appearance (probably as a list box—a.k.a. a SELECT box—on a Web page) bear two advantages. First, isolated, normalized data helps your site's visitors by offering a finite set of options. Selecting a state from a list is better than guessing at the two-letter abbreviation. If you had a text box on your Web page instead of a SELECT box, the input you'd receive from your visitors would vary wildly. When you ask for a state, one person might enter "California," another might write in "CA," and a third person might write "Ca." But when your visitors are choosing from such a list, your data remains normal, or standardized—the second advantage.

This article will focus on methods for populating and managing such SELECT boxes. We'll demonstrate with some basic examples and then progress into optimized, highly functional SELECT box codelets that use various methods to fill and manage both static and dynamic SELECT box controls.

The ASP script in Listing 1 generates a simple data-driven SELECT box. It displays a list of publishers that it pulls from a simple database table. Using such a mechanism—that is, displaying a pull-down list of publishers from which the user must make one selection—guarantees that data from the user is valid.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2