# CSS for a DataGrid

**URL:** <https://forum.kirupa.com/t/css-for-a-datagrid/233044>\
**Category:** flash\
**Created:** [July 19, 2007, 5:43pm UTC](https://forum.kirupa.com/t/css-for-a-datagrid/233044 "2007-07-19T17:43:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkarpenko](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pkarpenko/32/3051_2.png) [@pkarpenko](https://forum.kirupa.com/u/pkarpenko)\
**Post date:** [July 19, 2007, 5:43pm UTC](https://forum.kirupa.com/t/css-for-a-datagrid/233044/1 "2007-07-19T17:43:46Z")

</div>

I’m attempting to control text color of datagrid cells using a CSS file and I think I just hit a dead end.

I’ve extended the CellRenderer with

```auto
dgGrid.setStyle("cellRenderer", CustomRenderer); 

```

Within the CustomRenderer class, I set a stylesheet to the cell’s text field with

```auto
this.textField.styleSheet = cssSheet;

```

And upon running the code, I get this error:

Error: Error #2009: This method cannot be used on a text field with a style sheet.  
at flash.text::TextField/setTextFormat()

It’s referring to the cell’s text field. I am not applying a text format to the text field, so I can only assume this is some automatic thing that the DataGrid does.

Anyone know a way around this?
