Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to hide the header row, displaying column headers, for a specific view on a SharePoint 2010 publishing page? We've used this CSS to hide the column headings, but this is all or nothing; in other words, we can't hide and show the column header for an individual view:

tr.ms-viewheadertr{
  display:none;
}

In addition, setting a TR's display to none has other issues: IE7 can't handle display:table-row when you need to show the column again; you have to use display:inline-block for that one browser and the table-row for modern browsers. Plus, this technique affects all of the views on the page rather than the specific one we need to handle.

Anyone know of a way to hide/show the column headings from the web part editor or some cleaner solution? Thanks.

share|improve this question
    
Possible solution using jQuery and CEWP: $("table[summary*='List name']").each(function(){ $(this).find("tr:eq(0)").show(); });, from here: code-journey.com/2011/… –  Alex C Oct 19 '11 at 9:00

2 Answers 2

up vote 2 down vote accepted

You can add the following to an .xsl file and link to it in the "Miscellaneous" options when you edit the web part. By doing it this way, you can reuse the same style sheet over and over.

This xsl basically overrides a couple of templates located in the "vwstyles.xsl" file, and removes the lines that add the header.

(This code works in production, but I may not have replicated it properly in this forum, so please test first.)

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" 
                xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" 
                xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" 
                xmlns:asp="http://schemas.microsoft.com/ASPNET/20" 
                xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
                xmlns:SharePoint="Microsoft.SharePoint.WebControls" 
                xmlns:ddwrt2="urn:frontpage:internal" 
                xmlns:o="urn:schemas-microsoft-com:office:office">
   <xsl:include href="/_layouts/xsl/main.xsl"/>
   <xsl:include href="/_layouts/xsl/internal.xsl"/> 
   <xsl:template  match="View" mode="full">
      <xsl:apply-templates select="." mode="RenderView" />
      <xsl:apply-templates mode="footer" select="." />
   </xsl:template>
   <!-- Boxed and Boxed No Labels -->
   <!-- Issues Boxed and Boxed No Labels -->
   <xsl:template  match="View[ViewStyle=/@ID='12' or ViewStyle=/@ID='13' or ViewStyle=/@ID='18' or ViewStyle=/@ID='19']" mode="full">
      <xsl:apply-templates select="." mode="RenderView" />
   </xsl:template>
</xsl:stylesheet>
share|improve this answer

Treat the views as DVWP, since they are XSLT List Views (XLV) then you can go in and edit them in SharePoint designer and remove the header for a specific column.

share|improve this answer
    
Could you expound on this? What do you mean by "Treat the views as DVWP"? –  Alan M May 9 at 18:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.