views:

344

answers:

1

I am having some difficulties with a GridView here, a client asked me to put some space between the cells, typically I would do CellSpacing="5" however it seems it is not working, I tried a few stuff and everything is rewritten...

Code I tried :

<asp:GridView ID="gvShoppingCart" runat="server" CellSpacing="5" Width="100%" AutoGenerateColumns="false">

<some-formating-columns-here />

</asp:GridView>

What is actually rendered is :

<table cellpadding="0" cellspacing="0" summary="">
    <thead>
     <tr class="AspNet-GridView-Header">
      <th scope="col">Produit</th>
      <th scope="col"> </th>
      <th class="Center" scope="col">Quantité</th>
      <th class="Right" scope="col">  Prix Unitaire  </th>
      <th class="Right" scope="col">Prix</th>
     </tr>
    </thead>
<body-columns-here />
</table>

I have no idea of what to add now...

Any suggestions ?

A: 

Have you tried using CSS. If you know the class that is being applied to the HTML element you could use CSS-padding for that particular CSS class. I would give that a shot.

An example would be:

You CSS class would look like:

.gvShoppingFormat td { padding-left: 5px; padding-right: 5px; }

Matt
Padding isn't the right option since it will add space inside of the cell, not outside. I want to put really 5 pixels between each cell containers. I would be margin: 5px, but it seems it is not enough.
Erick