Friday, May 1, 2009

GridView Gridline color

During web development I came across the problem of how to set the GridLine color in the gridveiew. Here is the simple line of code you can use to set the grid line color.

grdvOrders.Attributes.Add("bordercolor", "#acc0e9");

Here is the sample output of my grid view control when i have not used the above line of code in my Page_Load event handler. As I have set the GridLine property of the grid view control to Both so the grid line are shown here, but the color of the grid line are white.

And here is the output of the my grid view control when i have used the code of adding the border color to the attributes of the grid view control.

In the image above you can see the that grid line color is set now, which I have provided in the attribute of the grid view control. This is the short tip regarding the grid view control of how to set color of the grid line.

All and any comments / bugs / suggestions are welcomed!


Anonymous said...


element69 said...

Thanks for posting!

lovely dog said...

thanks so much