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
275
Set the CssClass of an UltraGridCell
posted

I want to show certain cells in my UltraWebGrid in gray and italics, based on values in other cells in the row.  However, I would like to do this using a css style so that we can easily alter the appearance at individual customer sites.  Is there a way on the server side to add an additional class to an individual cell?

  • 12679
    Verified Answer
    posted

    Hello,

    Please refer the sample code below :

     

    foreach (UltraGridRow row in UltraWebGrid1.Rows)

                {

                    foreach (UltraGridCell cell in row.Cells)

                    {

                        cell.Style.CustomRules = "color:red";

     

                        cell.Style.CssClass = "put here you css class";

                    }  

                }

    In this case you can specify css classes outside of the page and apply them based on the logic you have.

    Hope this helps.