我试图在整个标题文本下划线,使其看起来像下图(标记为“试图使其看起来像”)。但它不会在整个标题文本中带有一致的下划线。感谢您的帮助。
图片中声明“试图让它看起来像”的部分是我希望它看起来像的 图片中声明:“目前看起来”的部分是它目前的样子。
代码附在下面
<asp:GridView runat="server" ID="grdvwDepositTransaction"
AutoGenerateColumns="false" DataKeyNames="Status"
OnRowCommand="grdvwDepositTransaction_RowCommand" ShowHeaderWhenEmpty="true" OnRowDataBound="grd_RowDataBound"
CssClass="grid">
<Columns>
<asp:TemplateField>
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DepositEntry.cardNumber" HeaderText="Card Number" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.accountNumber" HeaderText="Account Number" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.firstName" HeaderText="Customer Name" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.transactionDateTime" HeaderText="Transaction Date/Time" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.cashAmount" HeaderText="Cash Amount" ItemStyle-CssClass="mediumColumn columnCenter" />
<asp:BoundField DataField="DepositEntry.depositAmount" HeaderText="Envelope Deposit Amount" ItemStyle-CssClass="mediumColumn columnCenter" />
</Columns>
<EmptyDataTemplate>
<br />
<br /><br />
<span style="font-weight: bold; text-anchor:middle;">No Transactions have been entered</span>
</EmptyDataTemplate>
</asp:GridView>
<table class="grid" cellspacing="0" rules="all" border="1" id="MainContent_grdvwDepositTransaction" style="border-collapse:collapse;">
<tr style="text-decoration:underline;">
<th scope="col"> </th><th scope="col">Card Number</th><th scope="col">Account Number</th><th scope="col">Customer Name</th><th scope="col">Transaction Date/Time</th><th scope="col">Cash Amount</th><th scope="col">Envelope Deposit Amount</th>
</tr><tr>
<td colspan="7">
<br />
<br />
<br />
<span style="font-weight: bold; text-anchor:middle;">No Transactions have been entered</span>
</td>
</tr>
</table>
<br />
</div>
</div>
最佳答案
此 CSS 将为具有 grid
类的 table
的第一个 tr
提供底部边框:
table.grid tr:first-of-type {
border-bottom: 5px solid black;
}
关于c# - 尝试在此 gridview 中为标题文本加下划线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26470355/