Hi Sidhu To change label color in grid you can use item renderer for those columns where you want to change color. I am posting you some code may this will help you.
************************************************************************ <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:HBox width="100%" height="100%" backgroundColor="#C8CBCC" verticalAlign="middle" horizontalAlign="center"> <mx:DataGrid id="cusipGrid" width="500" height="300" dataProvider="{employeeRecord}"> <mx:columns> <mx:DataGridColumn headerText="Employee Name" dataField="EmployeeName" /> <mx:DataGridColumn headerText="Employee Age" dataField="EmployeeAge" itemRenderer="asCode.ColoredCell"/ > </mx:columns> </mx:DataGrid> </mx:HBox> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] private var employeeRecord:ArrayCollection = new ArrayCollection( [{EmployeeName : "emp1" , EmployeeAge : 25 }, {EmployeeName : "emp2" , EmployeeAge : 68 }, {EmployeeName : "emp3" , EmployeeAge : 15 }, {EmployeeName : "emp4" , EmployeeAge : 12 }, {EmployeeName : "emp5" , EmployeeAge : 28 }, {EmployeeName : "emp6" , EmployeeAge : 71 }] ); ]]> </mx:Script> </mx:Application> **************************************************************************** Now make a class ColoredCell in asCode package Which extends Label class. ************************************************************************** package asCode { import mx.controls.Label; public class ColoredCell extends Label { private const RED_COLOR:uint = 0xFF0000; private const GREEN_COLOR:uint = 0x00CC00; private const BROWN_COLOR:uint = 0xC28547; public function ColoredCell () { super(); } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); /*** Now change color of column EmployeeAge here i have set label color red to those employee whose age below 18 green between 18 to 60 brown above 60 */ var ageValue:Number = parseFloat(data.EmployeeAge); if(ageValue <= 18) setStyle("color",RED_COLOR); else if(ageValue > 18 <= 60) setStyle("color",GREEN_COLOR); else setStyle("color",BROWN_COLOR); setStyle("fontSize",10); setStyle("fontWeight","bold"); setStyle("textAlign","right"); } } } *********************************************************************** Please try this may it will solve your purpose. On Oct 7, 4:12 am, Sidhu Vijay Sidhu <[email protected]> wrote: > hi i hve datagrid and in some cells i am displaying some text which it is > taking from lable function now my requirement is that i need to change the > color of those text too in all the cells where it is displaying but in label > function i think we cannot set the style of the text... and there is no > style function for datagrid pls help asap if anybdy have solution -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.

