亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

gridview生成時如何去掉style屬性中的border-collapse

 更新時間:2014年09月30日 15:41:25   投稿:whsnow  
默認(rèn)gridview控件會在生成的html代碼中的style屬性中加入border-collapse:collapse,如果想把它去掉的話

在vs2005下用到gridview時,默認(rèn)的情況下gridview控件會在生成的html代碼中的style屬性中加入border-collapse:collapse;

復(fù)制代碼 代碼如下:

<asp:GridView ID="GridView1" runat="server" BorderWidth="0"></asp:GridView>

綁定數(shù)據(jù)運(yùn)行后頁面中的代碼為:

<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>

gridview控件就自動給加上了:border-collapse:collapse;

要想去掉這個自動加入的代碼只要將 CellSpacing="-1"就可以了,加上后html的代碼為

<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>

補(bǔ)充一點(diǎn):

GridLines="None" 不顯示單元格邊框
CellSpacing="-1" 去掉GridView style中的border-collapse:collapse;樣式

備注:在firefox瀏覽器遇到的問題,邊框合并導(dǎo)致部分邊框線條變粗,GridLines="None" 可以解決

相關(guān)文章

最新評論