Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to change the color of a row of data grid view in visual studio 2010 c#.
i want to see a specific row of datagrid other than white color... how cna i do that
Posted

Loop through the rows of the datagrid, and basaed on your conditions change the color.
For e.g.
C#
for(int i = 0; i<dgvReservations.RowCount; i++)
{
if (myGird.Rows[i].Cells[conditionCell] == myCondition);
{
myGrid.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.Red;
}
}
 
Share this answer
 
v2

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