gridview生成時如何去掉style屬性中的border-collapse
在vs2005下用到gridview時,默認(rèn)的情況下gridview控件會在生成的html代碼中的style屬性中加入border-collapse:collapse;
<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)文章
js中刪除數(shù)組中的某一元素實(shí)例(無下標(biāo)時)
下面小編就為大家?guī)硪黄猨s中刪除數(shù)組中的某一元素實(shí)例(無下標(biāo)時)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-02-02require導(dǎo)入module.exports 或 exports導(dǎo)出的使用方法
module.exports用于導(dǎo)出整個模塊的內(nèi)容,可以通過賦值給 module.exports 導(dǎo)出一個對象、函數(shù)或值,導(dǎo)出的內(nèi)容可以被其他模塊通過require 導(dǎo)入,本文給大家介紹require導(dǎo)入module.exports 或 exports導(dǎo)出的使用,感興趣的朋友一起看看吧2023-11-11JavaScript實(shí)現(xiàn)前端實(shí)時搜索功能
這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)前端實(shí)時搜索功能 ,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-04-04利用了jquery的ajax實(shí)現(xiàn)二級聯(lián)互動菜單
二級聯(lián)互動菜單,利用了jquery的ajax實(shí)現(xiàn),具體實(shí)現(xiàn)如下,喜歡的朋友可以參考下2013-12-12