This is a migrated thread and some comments may be shown as answers.

In Formview DataRowView Is Nothing

1 Answer 34 Views
Getting started with ASP.NET
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 02 Mar 2009, 09:17 PM
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

 

1 Answer, 1 is accepted

Sort by
0
Mia
Top achievements
Rank 1
answered on 30 Jul 2014, 04:11 PM
It may help to know that DataRowView is under System.Data class library.  You may have to add a reference.
Tags
Getting started with ASP.NET
Asked by
Jerry
Top achievements
Rank 1
Answers by
Mia
Top achievements
Rank 1
Share this question
or