PDA

Click to See Complete Forum and Search --> : Selected item problem


ttingen
Aug 30th, 2000, 03:57 PM
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.


<%

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>

ajc
Aug 31st, 2000, 08:58 PM
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.

ttingen
Sep 1st, 2000, 09:40 AM
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.