Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GridView and vertical gridlines

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I'm making use of a standard GridView control (in ASP.Net with C# code).

I want vertical grid lines - however when I set the GridLines property (for the GridView control) to either 'Vertical' or 'Both' - the resultant vertical line is only faint (possibly a light blue thin line).

How can you format the vertical line in a GridView control (bearing in mind I do not want horizontal lines)?
Can this be done easily?

Thanks in advance.
Steve
 
CSS. set the css class of the table and then define the proper css elements to style your grid.

I find that using the styling properties of web controls is a hack at best. why should the server code be concerned with layout? all the code behind should do is pass data to the markup for presentation. the code behind could be responsible for setting the css property of web controls.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Not being all that experienced with css - would someone be able to suggest how I can achieve these vertical lines in the GridView cells via means of setting the style?

Thanks again.
Steve
 
Had that same problem a bit ago. This worked for me.
Try adding the cellspacing and cellpadding to the grid like this:

<asp:GridView
ID="GridView1"
Runat="server"
BorderColor="Black"
CellPadding="1"
CellSpacing="1"
BackColor="Black"
BorderWidth="1px"

SMBrown
 
Thanks for the suggestion - but when I tried that yesterday (from some code I found online) I found that it gave me both vertical and horizontal lines.
However that was the simplest way to control both together. :)

I had to resort to setting a CssClass against the ItemStyles of the template fields - giving me just the vertical lines as required.

 
I had to resort to setting a CssClass against the ItemStyles of the template fields - giving me just the vertical lines as required.
which is the proper way to style an DOM element.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top