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

Please visit our partners

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

ASP Source Code:
' Declare our variable
Dim iChoice
' Read in the choice the user clicked on.
' This will equal "" (an empty string) if no choice is there
iChoice = Request.QueryString("choice")
' Execute the appropriate branch based upon the value of the variable we just read in.
Select Case iChoice
	Case "1"
		<H3>This is what happens when you click on Case 1</H3>
	Case "2"
		<H3>This is what happens when you click on Case 2</H3>
	Case "3"
		<H3>Surprise, Surprise, This is what you get when you click on Case 3</H3>
	Case Else
		' This executes if no of the other conditions are met!
		' This actually runs the first time through when the user
		' arrives at this page because the choice is blank.
End Select
' You might also notice that in the above cases I was comparing the value of iChoice
' to strings containing numbers and not to the actual numerical values 1, 2, and 3.
' If I wanted to use the numerical values I should technically convert iChoice to a
' number before doing the comparison because 3 is really not the same as "3".  VBScript
' will let you get away with it occasionally, but it's good practice to actually do the
' conversion and, as an additional benefit, doing so will also help avoid confusion
' when people are reading your code. CInt or CLng is the appropriate command:
'Select Case CInt(iChoice)
'	Case 1
'		...
'	Case 2
'		...
'	...
'End Select
Click on the different cases below:<BR>
<A HREF="./case.asp?choice=1">Case 1</A> 
<A HREF="./case.asp?choice=2">Case 2</A> 
<A HREF="./case.asp?choice=3">Case 3</A>

Back the the Sample Output

Back to the Sample Index

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