I have a some profile values which are being declared inside a loginview.
I also have a custom control which displays a profile address.
My issue is that in order to display the control populated with the profile informaiton I need to set autoeventwireup to true. But when I do this then an exception is thrown "value of instance not set to instance of object" -- for Label1.Text = Profile.CompanyName etc.... If I set autoeventwireup to false the profile information is displayed fine.
This is the code behind of the page.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not Page.IsPostBack Then
Dim Label1 As Label = CType(LoginView1.FindControl("Label1"), Label)
Dim Label2 As Label = CType(LoginView1.FindControl("Label2"), Label)
Dim Label3 As Label = CType(LoginView1.FindControl("Label3"), Label)
Dim Label4 As Label = CType(LoginView1.FindControl("Label4"), Label)
Dim Label5 As Label = CType(LoginView1.FindControl("Label5"), Label)
Dim Label6 As Label = CType(LoginView1.FindControl("Label6"), Label)
Dim Label7 As Label = CType(LoginView1.FindControl("Label7"), Label)
Dim AddressDetailsInfo As ASP.displayaddress_ascx = CType(LoginView1.FindControl("AddressDetailsInfo"), ASP.displayaddress_ascx)
AddressDetailsInfo.AssignAddress(Profile.AddressDetails)
Label1.Text = Profile.CompanyName
Label2.Text = Profile.Address
Label3.Text = Profile.Telephone
Label4.Text = Profile.Website
Label5.Text = Profile.Postcode
Label6.Text = Profile.Email
Label7.Text = Profile.Fullname
End If
End Sub
Any ideas?
Thanks
Andrew
Current project:
Abtec Network Systems