PDA

View Full Version : Problem with a dropdown calendar control


therod1946
06-22-2004, 10:31 AM
I just created a dropdown calendar user control. The control is comprised of a textbox, an HTML input button, and a calendar control. I inserted it into a working page, taking the place of a calendar control which I had been using to provide the date of an event. It worked fine when I wrote it's value to the database.

OLD CalendarAddEvent.aspx...
<td valign="top">Event Date:</td><td valign="top"><asp:calendar id="idDate" runat="server" />

OLD code behind
' Event Date</font id="green">
Dim parameterDate As New SqlParameter("@dpEventDate", SqlDbType.DateTime, 8)
'Get the value of the selected date </font id="green">
parameterDate.Value = idDate.SelectedDate
myCommand.Parameters.Add(parameterDate)

I replaced the calendar with the new user control (dropdown calendar) thus...

NEW CalendarAddEvent.aspx...
<uc1:CalendarControl id="Calendar1" runat="server"></uc1:CalendarControl>

NEW code behind
' Event Date</font id="green">
Dim parameterCalendar1 As New SqlParameter("@dpEventDate", SqlDbType.DateTime, 8)
'Get the value of the selected date </font id="green">
parameteCalendar1.Value = Calendar1l.SelectedDate
myCommand.Parameters.Add(parameterCalendar1)

The error I am getting is 'Name Calendar1 is not declared'</font id="red">

I don?t understand why it isn?t declared. What am I doing wrong? How do I extract the date value from this new user control to write it to the database?

Tom