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

-Collapse +Expand ASP Classic Group Home

Week 38 Lesson◄╣

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

Weekly ASP Classic Lesson

Week 38, Posted Monday 9/20/2021

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"  
   strSelectedString = ""  
  End If          
  YesNoDropDown = YesNoDropDown & "<option value='" & YesNoCode(i) & "' " & _      
  strSelectedString & " >" & YesNoName(i) & "</option>" & vbcrlf 
 YesNoDropDown = YesNoDropDown & "</select>" & vbcrlf 
End Function

Posted By Mike Prestwood, Post #102169, KB Topic: ASP Classic
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

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