IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
ASP Classic
Search ASP Classic Group:

Advanced
-Collapse +Expand ASP Classic Group Home

WEEKLYLESSON
Week 6 Lesson◄╣

MY
GROUPSETTINGS
-Collapse +Expand ASP Classic Store
   ► All GroupsASP Classic Group   Print This    All Groups  

Weekly ASP Classic Lesson

Week 6, Posted Monday 2/10/2025

Content changes every Monday @ 1AM!! Check back once per week. Learn! Review! Test Yourself!

Lastest ASP Classic Flashcard

Our flashcards are part of our library of tidbits.

Tidbits are FAQs, Definitions, Tips, and Code Snippets from our knowledge base.

ASP Classic Yes/No Function

The following function demonstrates one technique for coding a Yes/No dropdown. It uses a for loop which can be expanded to handle more than the 3 states (Y, N, and blank).

Example of calling the function:

Do you fish? <%=YesNoDropDown("ynFish", "")%>
Function YesNoDropDown(strName, strSelected) 
 Dim i
 Dim strSelectedString
 Dim YesNoName
 Dim YesNoCode
 YesNoName = Array("Yes","No")  
 YesNoCode = Array("Y","N")
 
 YesNoDropDown = "<select name='" & strName & "'>" & vbcrlf
 YesNoDropDown = YesNoDropDown & "<option>" & "--" & "</option>"
 
 For i = 0 To UBound(YesNoName)  
  If strSelected = YesNoCode(i) Then    
   strSelectedString = "Selected"  
  Else    
   strSelectedString = ""  
  End If          
  
  YesNoDropDown = YesNoDropDown & "<option value='" & YesNoCode(i) & "' " & _      
  strSelectedString & " >" & YesNoName(i) & "</option>" & vbcrlf 
 Next      
 
 YesNoDropDown = YesNoDropDown & "</select>" & vbcrlf 
End Function

 
Posted By Mike Prestwood, Post #102169, KB Topic: ASP Classic
Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2025 Prestwood IT Solutions.   [Security & Privacy]