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

Was wondering if someone has experience coloring a calendar event based on the value of a category. I have seen guides to do this via Sharepoint Designer but would like a way to do this through the Visual Studio 2010 project that is creating the list. Details or a link are most appreciated.

TIA

share|improve this question

4 Answers 4

up vote 2 down vote accepted

CSS, javascript & calculated columns should do the trick. Read the following posts:

share|improve this answer
    
Use the first link and make sure you follow their recommendations for adding color to a Sharepoint 2010 calendar (needs a difference script). Other than that this works like a charm –  MikeC Oct 28 '11 at 3:31

One way to achieve this is through the calendar overlays feature. Create a view for each category. Then create a view that displays nothing (filter by date or something that excludes everything). Then add an overlay for each category view.

share|improve this answer
    
Here is one example of using the overlays programmatically: blog.falchionconsulting.com/index.php/2011/06/… –  John Chapman Oct 24 '11 at 14:29

Try this article on how to create a color coded calendar by category using JS in SharePoint 2010- http://www.sharepointbreak.com/2012/09/02/creating-a-color-coded-calendar-by-category-using-js-in-sharepoint-2010/

share|improve this answer
1  
Please try to provide more details to your answer, to make it more stand-alone from the link. The link may break before this page does :) –  Robert Lindgren Aug 14 '13 at 7:41

The simplest way is to make the Category display in one of the calendar mapped fields and add a CSS stylesheet either via Content Editor web part (one-off) or a CustomAction/DelegateControl (reusable).

Provided a week or day view has subheadings displaying the category, a style that will be supported by most modern browsers is as follows:

[title*=Warning].ms-acal-item {
    BACKGROUND-COLOR: yellow
}
[title*=Critical].ms-acal-item {
    BACKGROUND-COLOR: red
}
share|improve this answer

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.