Unknown server tag 'asp:ListView' error with Sharepoint 2010 / .Net 3.5
-
16-10-2019 - |
Question
I'm developing a visual web part in Visual Studio 2010 for sharepoint and i have a listview control embedded.
I keep getting this error message in runtime even though I made sure it's namespaces are included and everything in the right place.
any ideas?
Solution
I read some threads talking about a bug in .net 3.5 and that we need to reinstall the SP1 to solve the problem, while I found this time-savy solution by simply adding a line to web.config:
inside the tag:
<Pages>
<Controls>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</Controls>
</Pages>
Good luck
OTHER TIPS
Made sure the build setting is 3.5 and not 3.5 Client Profile?
The Visual Web Part template references the Extensions DLL that comes in .NET 3.5, but does not register all of the namespaces. This means the namespace System.Web.UI.WebControls
needed for ListView is missing.
Below this line:
<%@ Register Tagprefix="asp" Namespace="System.Web.UI"
Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
Add:
<%@ Register Tagprefix="asp" Namespace="System.Web.UI.WebControls"
Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>