So I have a Gridview that I would like to modify the look of for only certain cells, and I would like to treat those cells as one (if possible).
So first I am changing some of the cells background color on RowDataBound:
if (e.Row.RowIndex > 1 && e.Row.RowIndex < 7)
{
e.Row.Cells[1].BackColor = Color.Red;
e.Row.Cells[2].BackColor = Color.Red;
e.Row.Cells[3].BackColor = Color.Red;
e.Row.Cells[4].BackColor = Color.Red;
e.Row.Cells[5].BackColor = Color.Red;
}
This will change a 5×5 area of cells to red. Now what I would like to do next is put a border around the outside of that 5×5 area. I found the borderStyle and BorderColor for a cell, but is there a way for me to only turn on a border for one side of a cell so I can create my border?
Thanks
I’d advise you to use classes instead, don’t hard-code it like this. It will be easier to maintain etc.