Bei der Verwendung von GridView in VS2005 fügt die GridView-Steuerung standardmäßig Grenzkollapse hinzu: Zusammenfassungen zum Style-Attribut im generierten HTML-Code.
Die Codekopie lautet wie folgt:
<ASP: GridView ID = "GridView1" Runat = "Server" BorderWidth = "0"> </ASP: GridView>
Der Code in der Seite nach der Ausführung der Bindungsdaten ist:
<Table Cellpacing = "0" Regeln = "All" id = "GridView1" style = "Border-Width: 0px; Border-Collapse: Collapse;"> <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>
Das GridView-Steuerelement fügt automatisch hinzu: Grenzkollapse: Zusammenbruch;
Um diesen automatisch hinzugefügten Code zu entfernen, fügen Sie einfach Cellspacing = "-1" hinzu und fügen Sie den HTML-Code zu dem Codes hinzu
<table rules = "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>
Noch eine Sache:
Gridlines = "Keine" zeigt keine Zellgrenzen an
Cellspacing = "-1" Randkollapse entfernen: Zusammenbruch; Stil im Gridview -Stil
HINWEIS: Das im Firefox -Browser aufgetretene Problem führt dazu