problem extending class propertyhttp://forums.asp.net/t/1711676.aspx/1?problem+extending+class+propertyThu, 18 Aug 2011 04:19:35 -040017116764558342http://forums.asp.net/p/1711676/4558342.aspx/1?problem+extending+class+propertyproblem extending class property <p>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.&nbsp; I have successfully extended an existing class and have added a new property to that class.&nbsp; However when I go to pass the value into the new object it will not work.</p> <p>The original class is in an edmx file and here is the extension.&nbsp; both are in the same namespace:</p> <pre class="prettyprint">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</pre> <pre class="prettyprint"> 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 <br /><br />The solution builds with no errors however when I step through this portion of the code...the pa.profileAttributeTypes = type does not work. <br />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<br />are caught and I have no idea where I went wrong...tried numerous things to no avail.<br /><br />thanks <br /><br /><br /></pre> <pre class="prettyprint"><br /><br /></pre> <p></p> 2011-08-17T17:49:34-04:004558844http://forums.asp.net/p/1711676/4558844.aspx/1?Re+problem+extending+class+propertyRe: problem extending class property <p>sorry..fixed it</p> <pre class="prettyprint">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</pre> 2011-08-18T04:19:35-04:00