Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Can't set background-color
posted

I'm applying css to change background-color of a row, but only other styles change except background-color:

Example:

.Style
{
color: Blue;
background-color: Yellow;
}

While applying this style using this code WebHierarchicalDataGrid1.Rows[1].CssClass = "Style" so only text in blue and background with no change.

What is the issue?

  • 18204
    Verified Answer
    Offline posted

    Hello arseny,

     

    Thank you for posting on our forums!

    This is due to the alternate row styling.  Our CSS applies the alternate row with the following CSS selector:

     tbody > tr.igg_Alt > td
    {
        ...
        background-color: *color*;
    }

    When setting the Style property of a row in code, this gets applied to the "tbody > tr" and the alternating rows overwrites it in the "td".  This can be resolved by using the following CSS selector for your Style class:

     tbody > tr.Style > td
    {
        color: Blue;
        background-color: Yellow;
    }

    If you need further assistance with this, please let me know and I will be glad to help.