c# - 尝试在此 gridview 中为标题文本加下划线

标签 c# css asp.net gridview

我试图在整个标题文本下划线,使其看起来像下图(标记为“试图使其看起来像”)。但它不会在整个标题文本中带有一致的下划线。感谢您的帮助。

图片中声明“试图让它看起来像”的部分是我希望它看起来像的 图片中声明:“目前看起来”的部分是它目前的样子。

代码附在下面

enter image description here

  <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">&nbsp;</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/

相关文章:

jquery - CSS3 动画不工作 Firefox

css - 垂直对齐元素

javascript - ASP.Net - 无效的 Json 字符串

c# - 延迟按键操作中的搜索功能

c# - ASP .NET WebMethods同步

css - 如何在 IE8 条件语句中应用媒体查询

DropDownList 选择中的 JavaScript 属性值

asp.net - WebAPI 属性路由在 OWIN 中不起作用

c# - 如何确定openCV中图像相似度的百分比

c# - 您认为 C# 属性(或类似机制)是个好主意还是不鼓励使用它们?