Home > Web Front-end > JS Tutorial > body text

How to remove the border-collapse_javascript technique in the style attribute when generating gridview

WBOY
Release: 2016-05-16 16:34:52
Original
1681 people have browsed it

When using gridview under vs2005, by default the gridview control will add border-collapse:collapse;

to the style attribute in the generated html code

Copy code The code is as follows:



The code in the page after binding data is run:
<table cellspacing="0" rules="all" border="0" 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>
Copy after login

The gridview control is automatically added: border-collapse:collapse;

To remove this automatically added code, just add CellSpacing="-1", and the html code after adding it is

<table rules="all" border="0" 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>
Copy after login

Additional point:

GridLines="None" does not display cell borders
CellSpacing="-1" Remove border-collapse:collapse; style in GridView style

Note: The problem encountered in the Firefox browser is that border merging causes some border lines to become thicker. GridLines="None" can solve the problem

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!