Hello all, I've been struggling with this for the last 3 days and just can't seem to figure out where the breakdown is occurring. I have successfully extended an existing class and have added a new property to that class. However when I go to pass the value into the new object it will not work.

The original class is in an edmx file and here is the extension. both are in the same namespace:

Namespace Project.DataAccess
    Partial Public Class ProfileAttribute
        Public Property profileAttributeTypes() As ProfileAttributeType
            Get
                profileAttributeTypes = New ProfileAttributeType
                Return profileAttributeTypes
            End Get
            Set(value As ProfileAttributeType)
            End Set
        End Property
    End Class
End Namespace

Here is the function from a codebehind page that utilizes this class property

Private Function ExtractAttributes() As List(Of ProfileAttribute)
            Dim attributes As New List(Of ProfileAttribute)()
            For Each type As ProfileAttributeType In _presenter.GetProfileAttributeTypes()
                Dim lblAttributeTypeID As Label = TryCast(phAttributes.FindControl("lblAttributeTypeID" + type.ProfileAttributeTypeID.ToString()), Label)
                Dim lblProfileAttributeID As Label = TryCast(phAttributes.FindControl("lblProfileAttributeID" + type.ProfileAttributeTypeID.ToString()), Label)

                Dim txtProfileAttribute As TextBox = TryCast(phAttributes.FindControl("txtProfileAttribute" + type.ProfileAttributeTypeID.ToString()), TextBox)

                Dim pa As New ProfileAttribute()
                If Not String.IsNullOrEmpty(lblProfileAttributeID.Text) Then
                    pa.ProfileAttributeID = Convert.ToInt32(lblProfileAttributeID.Text)
                Else
                    pa.ProfileAttributeID = 0
                End If

                pa.ProfileAttributeTypeID = Convert.ToInt32(lblAttributeTypeID.Text)
                pa.Response = txtProfileAttribute.Text
                pa.CreateDate = DateTime.Now
                pa.profileAttributeTypes = type
                attributes.Add(pa)
            Next
            Return attributes
        End Function

The solution builds with no errors however when I step through this portion of the code...the pa.profileAttributeTypes = type does not work.
the values in type are there and the identical fields for pa.profileAttributeTypes are there however they will not accept the values. No error messages
are caught and I have no idea where I went wrong...tried numerous things to no avail.

thanks

Recommended Answers

All 2 Replies

Partial Public Class ProfileAttribute
        Private _profileAttributeType As New ProfileAttributeType

        Public Property profileAttributeTypes() As ProfileAttributeType
            Get
                Return _profileAttributeType
            End Get
            Set(value As ProfileAttributeType)
                _profileAttributeType = value
            End Set
        End Property
    End Class

Glad that you solved the problem on your own. please mark the thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.