Changing background of a particular cell of a grid

Changing background of a particular cell of a grid

try this in your ItemDataBound event if you are using DataGrid 

if ((e.Item.ItemType.ToString() != “Header”) && (e.Item.ItemType.ToString() != “Footer”) && (e.Item.ItemType.ToString() != “Pager”)){

e.Item.Cells[0].BackColor = System.Drawing.Color.Blue;

}

try this in your RowDataBound event if you are using GridView 

if (e.Row.RowType.ToString() != “Header” && e.Row.RowType.ToString() != “Footer” && e.Row.RowType.ToString() != “Pager”){

e.Row.Cells[0].BackColor = System.Drawing.Color.Blue;

}

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.