5
Answers

change back color if gridView cells has empty.

Sk Jha

Sk Jha

7y
227
1
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)
1
Amit Singh

Amit Singh

NA 3.7k 46.6k 9y
1.First Create on Website
 
2.Add one Master Page
 
3.Add One WebForm and add with Master Page
 
4.Create one Css page
 
https://www.asp.net/web-forms/overview/older-versions-getting-started/master-pages/creating-a-site-wide-layout-using-master-pages-cs
 
http://www.aspdotnet-suresh.com/2014/07/master-page-with-menu-control-in-aspnet-example.html 
 
 
0
Raja

Raja

NA 1.7k 45.3k 9y
Give some extensive explain sir.
0
Amit Singh

Amit Singh

NA 3.7k 46.6k 9y
Add external  CSS  to Master page
 
<link href="MyStyle.css" rel="stylesheet" type="text/css"> in head tag.
 
 
<asp:Textbox id="Textbox1" runat="server" CssClass="your class/id name">