Wednesday, June 15, 2011

Remove Column Headers from specific Web Part

How to remove column headers from specific web part? Many people recommend to insert a content editor web part to the page, then put the script below into it.


<style>
.ms-viewheadertr{ display:none; }
</style>


It works. However, this change affects all list view web parts on that page.

Some people recommend to use SharePoint designer to create a data view web part to replace the list view web part. It also works, but not so easy to maintain it.

The third solution is to change the xslt file of that list view......sounds too risky to me.

This "classic" problem has been there for many years, and it is getting more and more annoying. Below is my solution.

I built a visual web part "EFSPWebParts.ListViewNoHeader.wsp", which only asks for the URL of the list view.





You can download the solution file from codeplex

I hope this one helps.

4 comments:

  1. This is a nice solution, but am I correct in concluding the summary view cannot be used in conjunction?

    ReplyDelete
  2. Hi Jer,

    I haven't try that yet. But normally it only supports most basic list view (read-only view).

    ReplyDelete
  3. Thanks for the reply. Conversely, have you seen/made a web part to show column headers for one web part if someone has used code in a CEWP to hide them? I'm thinking of a scenario where there are a number of web parts where hiding most is desired but not all.

    ReplyDelete
  4. There is a web part property which controls whether display column header.

    ReplyDelete