Using the ListView Control in SharePoint 2010 Beta

by Christian Fredh 24. februari 2010 02:57

In SharePoint 2007 you had to modify the web.config file, manually or with a feature, to enable the ScriptManager, ListView and other features in ASP.NET 3.5.

SharePoint 2010 is built on ASP.NET 3.5 so it should just work. However, the namespace for the ListView control is not mapped in the web.config or in the SharePoint Project Item templates by default. If you do not register the the namespace you will see the "Unknown server tag 'asp:ListView'" error message if you for instance use it in a web part:

 

To fix it add this line to the <controls>-section under <system.web> and <pages>:

<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

Or register the namespace in the .ascx or .aspx file:

<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>

And it should work:

Hopefully they will add both before RTM.

Tags: , ,

SharePoint | SharePoint 2010

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About Christian Fredh

Christian Fredh

A twenty six year old solutions architect and developer living in Stockholm, Sweden. I work as a SharePoint consultant at Avega Group with .NET and SharePoint development.

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view. Use the information on this site at your own risk.

Copyright

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

© Copyright 2009, Christian Fredh.