Results 1 to 3 of 3

Thread: Selected item problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    104
    I'm new to asp so this has to be a pretty easy one you someone out there that is more seasoned.

    User clicks on a day on the calendar to add an event and a popup window appears with fields for the event name, etc.

    I want the date that the user selected on the calendar to appear selected in the combo boxes on the page's form.

    The way I code it uses the parameters in the QueryString but it isn't working. Any help would be appreciated.

    Code:
    <%
    
    	Dim iMonth, iDay, iCounter
    	
    	iMonth = Request.QueryString("Month")
    	iDay = Request.QueryString("Day")
    
    %>
    <td align="left">
    					<select name="Month" class="Input">
    					<%
    					For iCounter = 1 to 12
    						If iCounter <> iMonth Then
    							Response.Write "<option value='" & iCounter & "'"
    							Response.Write ">" & Left(MonthName(iCounter),3)
    							Response.Write vbCrLf
    						Else
    							Response.Write "<option value='" & iCounter & "'"
    							Response.Write " selected>" & Left(MonthName(iCounter),3)
    							Response.Write vbCrLf
    						End If
    					Next
    					%>
    						
    					</select>&nbsp;
    					<select name="Day" class="Input">
    					<%
    					For iCounter = 1 to 31
    						If iCounter <> iDay Then
    							Response.Write "<option value='" & iCounter & "'"
    							Response.Write ">" & iCounter
    							Response.Write vbCrLf
    						Else
    							Response.Write "<option value='" & iCounter & "'"
    							Response.Write " selected>" & iCounter
    							Response.Write vbCrLf
    						End if
    					Next
    					%>
    					</select>&nbsp;
    					<select name="Year" class="Input">
    					<%
                                            iYear = Year(now)
    					For iCounter = 1 to 4
    						Response.Write "<option value='" & iYear & "'"
    						Response.Write ">" & iYear
    						Response.Write vbCrLf
    						iYear = iYear + 1
    					Next						
    					%>
    					</select>
    				</td>

  2. #2
    New Member
    Join Date
    Aug 2000
    Posts
    10
    It looks as though you are passing the value in the querystring as a string and then trying to compare it to a number. If you convert the string to an integer it should work, like:
    ...
    If iCounter <> CInt(iMonth) Then
    ...

    Hope this helps.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    104
    ajc,

    That worked. Thanks.

    I'm used to VB and the ablilty to declare varables as a specific type and not worrying about type conversion.

    I knew it would be something easy.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width