Background color of a DataSheet view

February 25th, 2009 | Categories: css, SharePoint

I was stuck with a problem the other day when I was creating a custom theme for SharePoint. My DataSheet view was with dark background and I couldn’t find CSS class or element to be able to manipulate it.

Turns out that the DataSheet ActiveX is taking the body background color – which was also dark in my theme. Fixing this resolved the issue. But to be able to use the dark body background, apply the background to the form element.

Old CSS:

body{
    background-color:#707070;
}

Produced the DataSheet View
image

New CSS

body{
    background-color:#FFF;
}
form#aspnetForm {
    background-color: #707070;
    height: 100%; /*cover all the background*/
}

produced proper DataSheet view

image

  1. Arik
    April 20th, 2009 at 13:45
    Reply | Quote | #1

    Hi,
    Can you apply conditional formatting to datasheet view, e.g. change the background color of one row based on the value in one field.

  2. August 31st, 2009 at 16:19
    Reply | Quote | #2

    Wow, saved my life! I had dark blue background on a Project site :|

  3. Jordan
    September 14th, 2009 at 18:05
    Reply | Quote | #3

    This doesnt always work. Depending how its structured you may just have to rely on setting the background color of the page instead of using the form#aspnetForm class. Just use .body { background-color: #FFF; } instead if the #aspnetForm doesnt work.

  4. tom
    September 23rd, 2009 at 20:47
    Reply | Quote | #4

    Sorry to be such a retard but which css file do I add this code to?
    :-D

  5. Boris Gomiunik
    October 15th, 2009 at 23:23
    Reply | Quote | #5

    Hi, Tom! On any CSS that the SharePoint loads. If you’re using a theme and want to customize it by editing the site with SharePoint Designer, look for folder “_Themes” in your site. In that folder is a folder named by the selected theme (for example theme Jet has a folder JET). In this folder look for a similar named CSS file (JET….css). this is the one that SharePoint reads.
    Otherwise if you’re creating your own theme, it would be advisable to do this in theme.css.

  6. VB
    June 1st, 2010 at 12:24
    Reply | Quote | #6

    How to format datasheet view in Sharepoint? I have some editable and non-editable columns there and want to distinguish them with colours. How can I do that??

    Similarly there is a totals row, which is calculating subtotals of the columns? How can I chnage the colourof the row (Background as well as text colour)?

  7. Jessica
    February 2nd, 2011 at 11:58
    Reply | Quote | #7

    You solved a problem I’m thinking about for days within a few seconds – many thanks!

  8. Mike
    May 5th, 2011 at 19:11
    Reply | Quote | #8

    I just changed body{
    background-color:#707070;
    }

    to
    body{
    background-color:#FFFFFF;
    }

    and it works great. Thank you for the info.

  9. June 13th, 2011 at 08:32
    Reply | Quote | #9

    This is brillilant information, thanks !

  10. MarkH
    June 27th, 2011 at 18:13

    Thanks! You’re a life saver!