Unknown server tag ‘asp:ListView’ in SharePoint 2010

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=, 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.


About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in SharePoint. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s