3

I would like to format columns or rows that contain certain values, without any client side javascript hacks. I'm looking for an OOB solution.

For example - if 1 column in my list being of type boolean (yes/no) contains a no valid - I would like to change the background color of the row.

Or if a column contains a text field, and let's say with the value of "Not updated" - I would like to change the font in that column to #ff0000;

Last example would be to check a date range, and if a column in the list (date column) has a value that meets certain criteria then so some or other styling to the row or a specific column.

Is any of this possible?

1
  • Are you willing to consider a 3rd party solution, or making your own Custom Field Type?
    – Stu Pegg
    Commented Oct 17, 2011 at 19:03

2 Answers 2

3

As Lori says, because this is XSL-based you have several options. I can think of three ways to get your XSL in place off the top of my head:

  1. Edit in SharePoint Designer 2010 and do some 'conditional formatting'. This will in effect embed the XSL in the web part.

  2. Put your XSL in a separate file and use the XSL Link property to add it to the web part. One advantage of this is that it can be re-used across several web parts. I've blogged on this XLV Override Technique previously, including an example based on a out of the box tasks list.

  3. Deploy some XSL to the file system, making use of the extensibility of the fldtypes_*.xsl technique - similar to as if making a completely custom field type. This is a useful approach if you'd like your formatting to be applied universally without having to worry about configuring specific web parts - and can even be targeted at specific columns and/ or lists.

HTH

2
  • +1 for the list of options and decent blog post, but look, have you actually tried the 3rd option yourself (with fldtypes_*.xsl)? It doesn't work for me and I heard from my fellows about the same issue. Commented Oct 17, 2011 at 22:52
  • Hi Omlin - yes I've tried option 3. I've done this to target a specific column on a list by targeting the column name and the list ID.
    – Glyn
    Commented Oct 18, 2011 at 7:57
5

Since list views in SharePoint 2010 are XSL list views, you can apply conditional formatting to them through SharePoint Designer, just like you can with Data View Web Parts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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