Trying to use the ListView control in SharePoint 2010 and you’ll probably get the error above. Googling and you’ll find that most people suggest adding the tag below to the web.config:
<%@ Register Tagprefix="asp" Namespace="System.Web.UI.WebControls" Assembly="System.Web.Extensions, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
While this indeed fixes the problem, you’ll have to either manually change the web.config of your SharePoint server – which IMO is a bad idea, or write some code to deploy the web.config change.
My prefer fix is to just add the tag to the page that is using the control instead. In an application page or a visual web part’s user control, you will find that there is already an ‘asp’ tag prefix registered. It however points to the System.Web.UI namespace. The ListView controls sits under the System.Web.UI.WebControls namespace – hence the problem. Just add another ‘asp’ tag as above to the page/user control and you will be fine.