[RESOLVED] Compiler Error Message: BC30456: 'SelectedDate' is not a member of 'Calendar'.

hello all just trying to insert a record into database i have a couple of dropdown list and labels and textboxes and a calendar.  These things are all inside a formview and a objectdatasoure control.  When i run the page i get the following error : Compiler Error Message: BC30456: 'SelectedDate' is not a member of 'Calendar'.

Here is my code behind formview1.iteminserting:

 

    Protected Sub FormView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles FormView1.ItemInserting
        If e.Values("flophours") = String.Empty Then
            e.Values("flophours") = 0
        End If
        If e.Values("mca1") = String.Empty Then
            e.Values("mca1") = 0
        End If
        If e.Values("mca2") = String.Empty Then
            e.Values("mca2") = 0
        End If
        If e.Values("mca3") = String.Empty Then
            e.Values("mca3") = 0
        End If
        If e.Values("vacation") = String.Empty Then
            e.Values("vacation") = 0
        End If
        If e.Values("notes") = String.Empty Then
            e.Values("notes") = "none"
        End If
        e.Values("dateinputed") = DateTime.Now
        e.Values("number") = 37891
        If e.Values("hoursworked") = String.Empty Then
            e.Values("hoursworked") = 0
            Dim Calendar1 As Calendar = TryCast(FormView1.FindControl("Calendar1"), Calendar)
            e.Values("dayworked") = Calendar1.SelectedDate.DayOfWeek
            e.Values("dayside") = True
            e.Values("nightside") = False
        End If

    End Sub

Any repley is welcome

Thanks Bob

Compiler might be considering Calendar as System.Globalization.Calendar and that's why you may be getting that error. Try specifying WebControls innstead

Dim Calendar1 As System.Web.UI.WebControls.Calendar = TryCast(FormView1.FindControl("Calendar1"), System.Web.UI.WebControls.Calendar)

you can debug this code

Dim Calendar1 As Calendar = TryCast(FormView1.FindControl("Calendar1"), Calendar)

thoughts on "[RESOLVED] Compiler Error Message: BC30456: 'SelectedDate' is not a member of 'Calendar'."

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>