5
Answers

change back color if gridView cells has empty.

how to change specific cells backcolor if cells has no data in gridview in asp.net
 
my code is here.. 
  1. for (int i = 0; i < GridView1.Row.Cells.Count; i++)  
  2.  {  
  3.     
  4.             if (GridView1.Row[i].Cells[2].Text == "")  
  5.             {  
  6.                 GridView1.Row[i].Cells[2].BackColor = Color.Red;  
  7.             }  
  8.            else  
  9.            {  
  10.                 GridView1.Row[i].Cells[2].BackColor = Color.Green;                    
  11.            }  
  12. }  

Answers (5)