Change you version of the target framework from visual studio by using property pages and selecting target framework to ".Net framework 4" from the build tab.
Also set following code in web.config file.
<system.web>
<pages enableviewstatemac="false" controlrenderingcompatibilityversion="3.5" clientidmode="AutoID" />
</system.web>