By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 3,274 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

Changing DataGrid Item BGCOLOR

P: n/a
JC
Is there a way to change the background color of a specific item in a datagrid based on it's value? For example, assuming I have the following table layout

genr
son
lengt

If the genre is 'Rock' then I would like to give the row a different color than if the genre is 'Rap'. It seems like this would be a pretty common desire, but I haven't been able to find any documentation on it, and today I've rammed my head against the wall trying to figure out how to do this

I've tried using template columns, but I cannot get it to work to save my life... Is there a way to do this? If I cannot change the color of the entire row is there at least a way to change the bgcolor of the actual genre item based on it's value

Any input or suggestions would be highly appreciated. Or if you can point me to any helpful links I would be delighted

Thanks
JC
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
JC
Ok, finally figured it out by doing a switch on e.Item.Cells[the_column] in the ItemDataBound event, and setting the Item.BackColor that way.
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.