This post will be covering how to use a data view web part to apply conditionally formatting to a list. You might want to use this technique to create simple heat maps for KPIs or as a visual indicator. An example of when this could be used is to color code expenses which are valued over $1,000.
- SharePoint Designer 2010
- A web page
- A List
- Dataview web part
In this post I will be assuming that you know how to obtain SharePoint Designer 2010, create a blank wiki or web parts page, and have a list already created that you need to conditionally format.
Now that we have all of that out of the way, let us move onto the How To!
- Open SharePoint Designer
- Open Your Site
- Enter Your Credentials
- Open the library where the page you created is stored, this is most likely in the pages or Site Pages library
- Right click the page that you created and select “Edit File In Advanced Mode
After opening the page in advanced mode you should be presented with Design, Split, or Code view. We will let SharePoint Designer do the heavy lifting for this exercise, so select the Design view.
1. Click into the web part zone that you would like to have your list displayed
2. Select the Insert Tab on the Ribbon
3. Select Data View
4. Select Your List
You should now have your list on the page as a data view web part. I have created an example list to show how we can use conditional formatting to better visualize our data. I will be creating a visual heat map only for my Relationship field for the sake of time, but the same concept could be applied to all of my other list fields.
- Select your td
- Select List View Tools
- Select Options
- Select Conditional Formatting
- Select Format Selection
- You will be prompted with the Condition Criteria Dialog Box
- Select the field you would like the condition based upon. I will be using my Relationship field in order to create my conditions.
- Select the comparison and value which makes sense for your situation. Since this list is only an example I have created extremely basic criteria.
- Select Set Style
- This dialog will provide you a list of options which could be used to conditionally format your fields. I will be setting my Background to match the color of the entry.
You will repeat these steps for each condition that you would like to conditionally format for. Don’t get confused by the term selection, the formation rules will be applied to all of your line items within the column. I never had to click another td while creating my rules, the conditions will automatically cascade down.
The last step is to save your changes and to do a refresh! Go check out your conditionally formatted data view web part!
I hope everyone was able to get this to work and fit their needs. Please feel free to leave a comment or reach out if you have any questions J