[RESOLVED] VS 2012 Porting code from Framework 2.0 to Framework 4.5
Hello all,
I am having problem porting some of my old codes to the new framework and the new visual studio, like the Profile.<Field> info:
Here is a snippet of my old Web.config:
Code:
<profile>
<properties>
<add name="Title" />
<add name="Forename" />
<add name="Surname" />
<add name="Initials" />
</properties>
</profile>
I have ported it exactly the same way in the new VS and but it can't seem to recognise the following code behind my asp page:
Code:
txtInitials.Text = Profile.Initials;
Any ideas what I'm doing wrong / what I have missed in the new frameworks?
Thanks,
Greyskull
Re: VS 2012 Porting code from Framework 2.0 to Framework 4.5
I haven't used 4.5 but it would be stupid if they have removed it without warning.
Have a look here:
http://odetocode.com/articles/440.aspx
Re: VS 2012 Porting code from Framework 2.0 to Framework 4.5
How is PROFILE declared - do you have some IMPORTS statements up top of this code? What is PROFILE part of?
Re: VS 2012 Porting code from Framework 2.0 to Framework 4.5
Many thanks for the replies. I have found it now.
Seems strange I can't access the "Profile.Initials" in the codefile (.aspx.cs) but instead can access it in the web form itself (.aspx).
Code:
<script runat="server">
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
Profile.Initals = txtInitals.Text;
}
}
</script>
Weird way of doing things but it works so it will do for now.