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
1320
How to set WebDataGrid's column background color with code behind ?
posted

Hello

I added columns to  my WebDataGrid dynamically with C# and I want to set the background color of those columns.
How can I do this please ?

Parents
No Data
Reply
  • 33839
    Verified Answer
    posted

    Hi gtarek,

    If you are creating the column dynamically, simply set the CssClass on the column itself to a class that has the background color defined that you desire.  

    BoundDataField col = new BoundDataField();

    col.Key = "NewField";

    col.CssClass = "red";

    If the color is not getting applied, you may need to use selectors in the css class definition.

    tbody > tr > td.red

    Regards,
    David Young 

Children