Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp .net Gridview change color of Vertical lines

Tags:

asp.net

I am trying to change the color of the horizontal and the vertical lines of an asp .net gridview. I am changing the cell border color but only the horizontal lines are changed. You can see a picture attached.enter image description here

like image 216
user1292656 Avatar asked Nov 28 '25 22:11

user1292656


1 Answers

You can use RowDataBound:

protected void gridView1_RowDataBound(Object sender, GridViewRowEventArgs e)
{
    foreach (TableCell tc in e.Row.Cells)
    {
        tc.Attributes["style"] = "border-right:3px solid red; border-bottom:3px solid blue";
    }
}

Of course you can also use CSS classes(via tc.CssClass) instead of the inline css.

like image 90
Tim Schmelter Avatar answered Dec 01 '25 14:12

Tim Schmelter