Cuando se usa GridView en VS2005, de forma predeterminada, el control GridView agregará colapso de borde: colapsar al atributo de estilo en el código HTML generado;
La copia del código es la siguiente:
<ASP: GridView id = "GridView1" runat = "Server" BorderWidth = "0"> </Asp: GridView>
El código en la página después de ejecutar los datos vinculantes es:
<table cellPacing = "0" reglas = "all" id = "gridView1" style = "border-width: 0px; border-colapse: colapso;"> <tr> <th scope = "col"> id </th> <th th scope = "col"> name </th> </tr> <td> 1 </td> <td> 1 </td> </tr> <tr> <td> 2 </td> <td> 2 </td> </tr> </table>
El control GridView agregará automáticamente: border-colapso: colapso;
Para eliminar este código agregado automáticamente, simplemente agregue CellSpacing = "-1" y agregue el código HTML a
<table reglas = "all" id = "gridView1" style = "border-width: 0px;"> <tr> <th scope = "col"> id </th> <th scope = "col"> name </th> </tr> <tr> <td> 1 </td> <td> 1 </td> </tr> <tr> <td> 2 </td> <td> 2 </td> </tr> </table>
Una cosa más:
GridLines = "Ninguno" no muestra los bordes de las celdas
CellSpacing = "-1" Eliminar el colapso del borde: colapso; Estilo en el estilo Gridview
Nota: El problema encontrado en el navegador Firefox, la fusión de borde hace que algunas líneas de borde se vuelvan más gruesas, las líneas de rejilla = "ninguno" puede resolverlo