In Formview DataRowView Is Nothing

2 posts, 0 answers
  1. Jerry
    Jerry avatar
    1 posts
    Member since:
    Mar 2009

    Posted 02 Mar 2009 Link to this post

    The following code alway returns DataRowView Is Nothing - I could use a little direction on how to find the break...

     

    Protected Sub HomeFormView_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)

     

     

        If HomeFormView.CurrentMode = FormViewMode.Insert Then

     

     

            Dim dv As DataRowView = CType(HomeFormView.DataItem, DataRowView)

     

     

            Dim ddlPU As DropDownList = HomeFormView.FindControl("ddlPropertyUnitName")

     

     

            Dim dsc As SqlDataSource = HomeFormView.FindControl("VacantPropertyUnitsSqlDataSource")

     

     

            If Not (dv Is Nothing) Then

     

     

                Dim m As Int32 = dv("PropertyID")

     

                dsc.SelectParameters(

    "PropertyID").DefaultValue = m

     

                ddlPU.DataBind()

     

                If Not IsDBNull(dv("PropertyUnitID")) Then

     

                ddlPU.SelectedValue = dv(

    "PropertyUnitID")

     

     

                End If

     

     

            End If

     

     

        End If

     

     

    End Sub

     

  2. Mia
    Mia avatar
    1 posts
    Member since:
    Jul 2014

    Posted 30 Jul 2014 in reply to Jerry Link to this post

    It may help to know that DataRowView is under System.Data class library.  You may have to add a reference.
Back to Top