I.T. Discussion Community!
-Collapse +Expand
ASP Classic
Search ASP Classic Group:

-Collapse +Expand ASP Classic Group Home

Week 32 Lesson◄╣

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

Weekly ASP Classic Lesson

Week 32, Posted Monday 8/12/2019

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
Follow PrestwoodBoards on: 

©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech