Add to My Yahoo! | Google Reader or Homepage | Add to Windows Live | Add to Windows Live Alerts

Wictor Wilén

SharePoint Server MVP / Author / MCT / MCTS / MCP / MSc writing about SharePoint and other interesting Microsoft technologies

Using the new ListView control in SharePoint

Posted at 2008-01-13 08:33 by Wictor Wilén in .NET , C# , SharePoint with 5 comments.

The Microsoft .NET Framework 3.5 contains a great new ASP.NET control called ListView. When using the ListView control you have much more control over how the output HTML will look like, which I think still is the main problem with the ASP.NET controls. To learn more about the ListView control, head over to Mustafa Basguns blog and read his excellent articles on the control.

The ListView control is great when working with SharePoint (WSS3 and/or MOSS 2007) custom pages, since designing SharePoint pages which adapts into the current administration or takes advantage of all the CSS styles demands you to have pretty good control of your HTML.

To use the ListView control in SharePoint you must first of all download and install the .NET 3.5 Framework on your SharePoint servers. After that you have to edit your web.config manually to get the control to work, otherwise you will get the following error message (if you have enabled error messages, otherwise you will get Unknown Error).

Unknown server tag 'asp:ListView'. 

Open web.config in Notepad (or what you prefer to edit it in) and paste the following under configuration/system.web/pages (after the tagMapping element)

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

Comments and trackbacks

#  Summing up the year of 2008 and embracing 2009 by Trackback
Screenshot from websnpr The time has come to make a summary of the past year and have a look into the future – the year of 2009. About a year ago I made a similar post with a summary and some predictions. This year has been...
#  Using the new ListView control in SharePoint by Tanmay Bari
Screenshot from websnpr Perfect Solution. Thanks !
#  One Question by LEI
The article talks about error messages, I would like to know how to enable them in Sharepoint Thank you very much
#  @LEI by Wictor
Screenshot from websnpr Hi, to enable the error messages; open the web.config file. 1) Change the mode attribute of the error element to Off. 2) Change Callstack attribute of the SharePoint/SafeMode element to True 3) Change debug attribute to true of the compilation element
#  Custom HTML by iFunky Development
Screenshot from websnpr Having started to use Sharepoint and finding customization very painful I think using .Net controls where possible is a great idea. I keep finding blogs pointing to CAML and that's nasty for simple html rendering!
Make a comment on this post:
Subject:  

Your name:  
Your Url:  
Note: submissions may have to be approved before being visible, so don't submit your comment multiple times.
Real Time Web Analytics