SELECT CASE Demo (Simple demo to use this)

Contributed by
Rating: 3 stars3 stars3 stars3 stars3 stars / 6
November 20, 1999
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement
This demo seems a is for the beginner but always a good refresher for the experienced programmer as I recently experienced.  Was working on a project that involved IF THEN and SELECT CASE Statements and need a basic how-to to refresh my mind how they work!!  One thing I forgot was Values are case sensative,  for example--when selecting Green it wasn't appearing.  After some review the value was green.  The letter "g" wasn't capitialized!  Geez!  So we want to share this demo on ASPFree.com if it help our users!  Using a SELECT CASE is a very efficient way of nesting several instances based on user input.  Instead of using IF THEN ELSEIF statements this offers you must more flexiability.

Heres the code Page One

<html><head><title></title></head><body>

<P>&nbsp;</P>
<form method="post" action="selectcase.asp" name="form1">
<TABLE border=1 cellPadding=1 cellSpacing=1 width="75%">

<TR>
<TD><STRONG><FONT color=green>Green</FONT></STRONG></TD>
<TD><INPUT name=radio1 type=radio value=Green checked></TD></TR>
<TR>
<TD><FONT color=blue>Blue</FONT></TD>
<TD><INPUT name=radio1 type=radio value=Blue></TD></TR>
<TR>
<TD><FONT color=red>Red</FONT></TD>
<TD><INPUT value=Red name=radio1 style="LEFT: 30px; TOP: 15px"
type=radio></TD></TR>
<TR>
<TD><STRONG>Black</STRONG></TD>
<TD><INPUT value=Black name=radio1 type=radio></TD></TR></TABLE>
<P><INPUT id=submit1 name=submit1 type=submit value="SELECT CASE DEMO"></P>
</form>
<P>&nbsp;</P>

</body></html>

Page 2

<%@ Language=VBScript %>
<%

dim myRadioColor

myRadioColor = request("radio1")

Select Case myRadioColor

Case "Green"
strColor = "Green"

Case "Blue"
strColor ="Blue"

Case "Red"
strColor = "Red"

Case "Black"
strColor = "Black"

Case Else
strColor = "Purple"

End Select
%>
<HTML>
<HEAD>
</HEAD>
<BODY>

<h1>You chose the color: <% = strColor %></h1>

</BODY>
</HTML>

blog comments powered by Disqus
ASP CODE ARTICLES

- ASP Forms
- ASP: The Beginning
- Getting Remote Files With ASP Continued
- Inbox and Outbox Manipulation in ASP
- Relational DropDownList Using VB.NET
- Ad Tracking URL Hits
- Use ViewState to display one record per page...
- Send Email using ASP.NET formatted in HTML
- ASP File Explorer
- ASP/XML Interview questions by Srivatsan Sri...
- Pressing RETURN won't submit the form
- This shows how you get the TEXT of a combo r...
- Group Data by Adrian Forbes
- Multiple checkbox select sample
- Multiple checkbox select with all values sam...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials