line colors in datagrid

ales

New member
Joined
Jul 4, 2003
Messages
3
Hi I have one problem:
I have datagrid on my form. I want that even lines is blue colored and odd lines is red colored. Ok in DataGrid Properties I set that normal items back color is blue and alternating items back color is red. But now I have to set that my second column is yellow if the line is blue and is brown if the line is red. You can set backcolor propertie for column but here you dont have properties for even and odd lines like normal and alternative lines.

Thank You
 
Hallo ales,

the DataGrid has an event called: ItemCreated

ServerSide C# Code:
Code:
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
//e.Item is your row
e.Item.Cells[1].BackColor = Color.Red
}

If you dont know if odd or even rownumber, save it in a Session-Variable... or maybe you can get the row-index of "e". You must try it!

-WebJumper
 
Back
Top