2

All,

I am trying to find the styles for the SPGridView HeaderStyle. It doesn't seem to work when i apply the following:

        spGridView.HeaderStyle.BackColor = System.Drawing.Color.Blue;
        spGridView.HeaderStyle.ForeColor = System.Drawing.Color.White;

It looks very strange. I have filtered columns and sort only columns. The sort only columns show up with no background, and the sort only columns show up somewhat okay, but they have a border where the dropdown for the filter context menu should be.

How do I fix this? See the image in this URL (I couldn't post it because I am a new user and they require i add more points):

http://spgridview.com/files/2-26-2012%2011-57-51%20PM.png

3 Answers 3

1

Here is what I did, it seemed to work.

But i know its not the final answer.

<style type="text/css">
.ms-viewheadertr th{
padding-top:0px;
background-color:#2878C0;
color:White;
}
.ms-viewheadertr .ms-vh2-gridview{
height:auto;
background-color:#2878C0;
color:White;
}

.ms-menuimagecell{
border:0px;
}

.ms-vh .ms-menuimagecell,.ms-vh2 .ms-menuimagecell,.ms-vh-icon .ms-menuimagecell{
border:0px;
}

.ms-vh .ms-menuimagecell img,.ms-vh2 .ms-menuimagecell img,.ms-vh-icon .ms-menuimagecell img{
border:0px;
}
</style>
1

Maybe It's not what you are looking for, I'm just sharing. I used this styles in all of my project whenever I utilize SPGridView to display data.

 Style="border-bottom-style: none; border-right-style: none; width: 100%;
        border-collapse: collapse; border-top-style: none; border-left-style: none;"
        CssClass="ms-listviewtable"
        HeaderStyle-CssClass="ms-viewheadertr" AlternatingRowStyle-CssClass="ms-itmhover"
        RowStyle-CssClass="ms-itmhover" SelectedRowStyle-CssClass="s4-itm-selected" RowStyle-Height="25"
1

Bill's answer worked for me.

In our application page, we need to override styles coming from Core.css which is shown in Bill's answer.

1
  • This section is for answers only Commented Feb 16, 2015 at 10:10

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.