ASP 101 - Active Server Pages 101 - Web06
The Place ASP Developers Go!

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

 Top ASP 101 Stories Top ASP 101 Stories
Connections, Commands, And Procedures
What is ASP?
VBScript Classes: Part 1 of N

Using Cookies in your ASP page
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates

Quick Tips

Persistent Radio Buttons
ASP pages are often used to both display a form, and carry out the action once the form is submitted. One of the most annoying tasks of HTML/ASP forms programing is keeping a user's chosen radio buttons selected when redrawing the form after it has been submitted. The following code is one way to create a one ASP page form that has persistent radio buttons:

<HEAD><TITLE>Pick a color</TITLE></HEAD>
<BODY BgColor=<%= Request.Form("Color")%>>
RedChecked = ""
BlueChecked = ""
YellowChecked = ""

SELECT CASE Request.Form("Color")
CASE "Red"
RedChecked = "CHECKED"
CASE "Blue"
BlueChecked = "CHECKED"
CASE "Yellow"
YellowChecked = "CHECKED"
Pick a color:<BR>
<FORM Method=Post>
Red: <INPUT Type=Radio Name=Color Value=Red <%= RedChecked%>>
Blue: <INPUT Type=Radio Name=Color Value=Blue <%= BlueChecked%>>
Yellow: <INPUT Type=Radio Name=Color Value=Yellow <%= YellowChecked%>>
<INPUT Type=Submit>

Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to:

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers