Highlight row color based on field values in Sharepoint 2010 list view

Option 1:

Go to SharePoint Designer 2010

  1. Go to your list, open the list view you want to modify
  2. in ribbon, select Options [Tab] – Conditional Formatting – Format Row option.

Option 2 (i haven’t tested it yet!!): (http://saltypc.com/?p=99)

  • Go to your list to be highlighted
  • Edit Page
  • Add a Content Editor Web Part
  • Move the CEWP to the bottom of the page
  • Click the Edit Source button
  • Copy and paste the following lines of code into the source code section

<script src=”/PublishingImages/javascript/jquery-1.3.2.min.js” type=”text/javascript”></script><script type=”text/javascript” language=”javascript”>var x = document.getElementsByTagName(“TD”) // find all of the TDsvar i=0;for (i=0;i<x.length;i++){if (x[i].className==”ms-vb2″) //find the TDs styled for lists{

if (x[i].innerHTML==”Next Day Pickup”) //find the data to use to determine the color


x[i].parentNode.style.backgroundColor=’yellow’; // set the color





Hi, Eric!

I’ve modified abit your code in order to avoid page scrolling loss when your code is applied to page.

function colorize(){

var x = document.getElementsByTagName(“TD”); var i=0;for (i=0;i<x.length;i++){ if (x[i].className==”ms-vb2″){ if (x[i].innerHTML==”Next Day Pickup”){ x[i].parentNode.style.backgroundColor=’#ccebff’; } } }

} // IE if (window.attachEvent){ window.attachEvent(“onload”, colorize); } // Other if (window.addEventListener){ window.addEventListener(“load”, colorize, false); }

This entry was posted in SharePoint 2010, SharePoint Designer 2010. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s