我有這2個ID選擇現有的CSS文件:使用CSS id選擇樣式GridView控件
#TableHead {
font-family: Arial, Helvetica, sans-serif;
font-size:11px;
font-weight: bold;
color: #000000;
border-top-width: thin;
border-top-style: solid;
border-top-color: #A9AAAA;
border-bottom-width: thin;
border-bottom-style: solid;
border-bottom-color: #A9AAAA;
}
#TableDivs {
border-bottom-width: 1px;
font-size:11px;
border-bottom-style: dotted;
font-family:Arial, Helvetica, sans-serif;
border-bottom-color: #A9AAAA;
}
我需要使用「TableHead」款式的GridView頭和「TableDivs」樣式的其餘部分Gridview控件。 我能夠通過在部分中封閉gridview來使用TableDivs。 如何使用TableHead來設置標題的樣式?我應該在哪裏指定id =「TableHead」?
加入後的GridView的渲染源代碼是:
<div id="TableDivs">
<div>
<table cellspacing="0" rules="all" border="0" id="ctl00_Main_GridView1" style="border-width:0px;font-weight:normal;border-collapse:collapse;">
<tr>
<th align="left" scope="col">
<a href="javascript:__doPostBack('ctl00$Main$GridView1','Sort$FileName')">File Name</a>
</th>
<th align="left" scope="col"><a href="javascript:__doPostBack('ctl00$Main$GridView1','Sort$Description')">Description</a>
</th>
<th align="left" scope="col"><a href="javascript:__doPostBack('ctl00$Main$GridView1','Sort$GroupName')">Folder Name</a>
</th>
<th align="left" scope="col">
<a href="javascript:__doPostBack('ctl00$Main$GridView1','Sort$TimeAdded')">Date Added</a>
</th>
</tr>
<tr>
<td style="width:30%;">
<a id="ctl00_Main_GridView1_ctl02_btnDownload" href="javascript:__doPostBack('ctl00$Main$GridView1$ctl02$btnDownload','')">2.txt</a>
</td>
<td style="width:40%;">222222</td><td style="width:25%;">group11</td>
<td style="width:5%;">
<span id="ctl00_Main_GridView1_ctl02_lblDateAdded"></span>
</td>
</tr>
<tr>
...
</tr>
</table>
</div>
</div>
我試過這個,但它不起作用。這隻會在我使用css類選擇器時才起作用。但在我的情況下,我必須使用CSS ID選擇器。 – KhD