This is a migrated thread and some comments may be shown as answers.

Change Highlight Color

2 Answers 405 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 11 Nov 2010, 09:03 PM
Hello - I would like to customize the background color of a row when it's highlighted and selected.  I've tried the following, but it only works a little.

When hovered, the background color changes, but an ugly gray border still exists along the bottom of the row.  Also, when selected, my desired background color only shows up when the selected row is hovered, not all the time.

The ASP/CSS I'm using are below:

ASP for Grid:
<!-- Grid -->
<telerik:RadGrid runat="server" ID="rgReport">
    <%-- Client settings --%>
    <ClientSettings EnableRowHoverStyle="true" Selecting-AllowRowSelect="true" />
    <%-- SelectedItemStyle settings --%>
    <SelectedItemStyle BackColor="Black" />
      
    <%-- MasterTableView Settings --%>
    <MasterTableView AllowSorting="true" Caption="" Summary="" ItemStyle-VerticalAlign="Top" />
</telerik:RadGrid>

CSS for Grid:
tr.rgRow:hover, tr.rgAltRow:hover
{
    background-image: none;
    background-color: #E9E8D1;
    border-bottom: 0px;
    margin-bottom: 0px;
    padding-bottom: 0px;
}

Please let me know what I can do...  Thanks!

-Ryan

2 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 12 Nov 2010, 02:47 PM
Hi Ryan,

You should use completely different CSS classes and no :hover pseudo class.

1. For hovered rows, use this for backgrounds

div.RadGrid_SkinName  .rgHoveredRow
{
        ...........
}

and this for border colors:

div.RadGrid_SkinName  .rgHoveredRow  td
{
        ...........
}


2. For selected rows use respectively

div.RadGrid_SkinName  .rgSelectedRow
{
        ...........
}

and

div.RadGrid_SkinName  .rgSelectedRow  td
{
        ...........
}


Hovered row styles should be placed after selected rows' styles, so that the former take precedence.

I recommend you to dump that BackColor property altogether and use CSS only.


http://blogs.telerik.com/dimodimov/posts/08-06-17/how_to_override_styles_in_a_radcontrol_for_asp_net_ajax_embedded_skin.aspx


Regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ryan
Top achievements
Rank 1
answered on 12 Nov 2010, 03:03 PM
Thanks for the help - that was exactly what I was looking for.  Everything works!  Thanks again.
Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or