Hi I've tried to change all of the lines vertical and horizontal in my
GridView from the code behind using the code shown below, but this does not seem to have any effect.
Can anyone offer a solution with the code behind please?
foreach (GridViewRow row in gvCurrentStageCircsPSTN.Rows)
foreach (TableCell cell in row.Cells)
cell.Width = 150;
cell.Height = 20;
cell.Attributes.CssStyle["text-align"] = "center";
cell.BorderColor = Color.FromName("Red");
In any case, I would recommend you to use css classes to apply styles to get a much more flexible UI layout.
As you confirmed the below is working. Great!
Now for the header
gridview.HeaderRow.Cells.CssClass = "something" . Try this out.
Note - only works if AutogenerateColumns = False, won't work for True(default!)
But as Claudio rightly pointed out, all styles should be a part of a css file & you should access them using css classes[preferably only from UI & not from code behind].
achieved this using CSS as suggested by @dumass