knrajt1938
New Member
Okay I researched this as much as possible before I posted so I hope this is not a repost but here goes...I made a datatable, lets say it has a coulmn called "cartype" , then I added a column called "color"well, I bound a gridview what I want to do is use a label, and have its FORECOLOR be the VALUE in the column "color".I tried this:\[code\]<asp:BoundField DataField="cartype" HeaderText="Cars" ItemStyle-Width="130" ItemStyle-ForeColor='<% Eval("Color") %>' />\[/code\]but I got an error about "Cannot create an object of type System.drawing.color from its string representation '<%Eval("color")%>' for the 'ForeColor' Property.I also tried adding a template field and got the same result.I was trying not to use the rowdatabound event and use .Cells[3] , because then when I add columns, it's going to change the cell number, and switch up everything! I was hoping I could make it cleaner by binding the color with the data.