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
WHDG - set row back color but does not highlight when selected

As above, I have a WHDG on a page and in the InitializeRow event I check to see the credit rating for the customer displayed on that row and set the background row color accordingly.

Infragistics.WebUI.Shared.Style rowStyle = new Infragistics.WebUI.Shared.Style();
rowStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFA0");
e.Row.CssClass = Infragistics.Web.UI.Framework.AppSettings.AppStylingManager.CssRegistry.Add(rowStyle, "TBODY TR.{0} TD");

This all works correctly however I also have row selection enabled yet when you select the row the background color does not change to show the selection.  I cannot find any attribute which would allow me to set the selected row color differently.  Not sure if it is relevant but I have grouping enabled also.

  • 20255
    Offline posted

    Hello, what do you think for the suggested approach?

  • 20255
    Suggested Answer
    Offline posted

    Hello cmdrew,

     Thank you for contacting us!

     About your question, my suggestion is to set a css class when activation behavior is invoked, by saying this I mean to set ActiveRowCssClass, in this way there is guarantee that some style will be applied on changing the row selection. As you can see from the attached sample I have custom row colors, and on selecting different rows, the "lightgreen" color is applied without issues.

     Code snippet:

    1. tbody > tr.ActiveRowClass > td
    2.         {
    3.             background-color: lightgreen;
    4.         }


    1. <Behaviors>
    3.                     <ig:Selection Enabled="true" CellClickAction="Row" RowSelectType="Single" >
    4.                     </ig:Selection>
    5.                     <ig:Activation ActiveRowCssClass="ActiveRowClass">
    6.                     </ig:Activation>
    7.                 </Behaviors>

     I hope that you will find this sample helpful.