- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
protected void GridView1_PreRender(object sender, EventArgs e)
{
System.Drawing.Color OddGridColor = new System.Drawing.Color();
OddGridColor = System.Drawing.Color.FromArgb(0xD3, 0xDE, 0xEF);
System.Drawing.Color EvenGridColor = new System.Drawing.Color();
EvenGridColor = System.Drawing.Color.FromArgb(0xEC, 0xE9, 0xD8);
for (int i = 0; i < GridView1.Rows.Count; i++)
{
if (i % 2 == 1)
{
GridView1.Rows[i].BackColor = OddGridColor;
}
else
{
GridView1.Rows[i].BackColor = EvenGridColor;
}
}
}
the way of change GridView color through one ...
Why do not use <AlternatingRowStyle> ?!!