Click here to Skip to main content
15,935,728 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have gridview i would like to display different color at first row of gridview by default first row always display any different color after rows should contain same color

so how to affect color for first row of gridview.

1 solution

use rowdatabound event for gridview

protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
 if (e.Row.RowType == DataControlRowType.DataRow)
   gridview1.Rows[rowindex].Cells[cellindex].BackColor = Color.FromArgb(224, 187, 220);
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900