1

SharePoint Server 2010. In SPD, I have applied Conditional Formatting to a document library row, so the background changes color based on a column value in the row. Works great when viewing the library via the "AllItems.aspx" page.

But, if I add that same library to a page as a web part, the conditional formatting is not applied, even when I have the view chosen. It is for sure the correct view as the particular columns chosen are there. No conditional formatting, though.

Is there something that would keep conditional formatting from working in a web part when it works fine when viewed directly?

3

I found the answer, and apologies to all for "answering my own question".

Googling more brought up suggestions about using the "XSL Link" option available in the List View Web Part. The examples I found had hand-coded XSL to stuff in there, but you can copy the XSL right out of the view's .aspx page in SPD.

Presume you have a view named "Foo" (use your own name of course). In SharePoint Designer 2010, edit the view "Foo.aspx". Copy the code between the starting and ending Xsl tags.

<Xsl>{copy all the stuff here and save as Foo.xsl}</Xsl>

Copy that code, and save it off to a file named Foo.xsl. Upload that Foo.xsl file to somewhere like the site's "Site Assets" folder. Over in the List View Web Part, in the "XSL Link" box, put in the URL to the Foo.xsl file. Click "Apply" and the conditional formatting should dispaly as intended.

(reference: http://www.glynblogs.com/2011/04/overriding-the-presentation-of-an-xslt-list-view-web-part.html , http://sharepointerthilosh.blogspot.com/2013/04/customise-list-view-webpart-using.html)

  • 2
    I know it is beyond shameless to comment on one's own answer to one's own question, but here goes: The solution I list does work, but it also results in a view where clicking on a list row returns "This item is no longer available." So, you get the conditional formatting, but lose any interactivity. – Alan M Oct 8 '14 at 22:41
  • I have the same issue, and you are right after implementing the xsl thing, interactivity has gone. how did you fix that? – Rishi Jagati Apr 24 '18 at 6:57
  • able to fix the issue from glynblogs.com/2011/05/… – Rishi Jagati Apr 24 '18 at 7:33
0

Adding the fix in Alan M. approach,

The first and obvious workaround is to not use the XSL Link property at all. I see that this can be done in two ways:

  1. Either edit the page in SharePoint Designer and the XSL will be embedded directly into the web part
  2. Or, if SPD is not available/ viable, export the web part (using this technique) and then manually edit the .webpart file to include the XSL in the XSL property
  3. The other workaround is to deploy your XSL to the LAYOUTS folder and then link to that. That seems to me a nice robust solution

however, it has to be contrasted to the amazing flexibility that is just tantalizingly out of reach by storing the XSL in a library on the site.

Ref: http://www.glynblogs.com/2011/05/xlv-bug-xsl-link-property-and-the-ecb-menu.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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