asp.net - ListView 内带边框的表格

标签 asp.net css

我希望带边框的表格显示在 ListView 中。我在 ListView 中使用了 html 表格,但我无法获取边框线(行和列)(尝试过 border="2")。我试图获取边框也使用 css,但我无法获取表格行。

代码:

<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">
 <LayoutTemplate>

                <table id="Table1" border="2" runat="server" class="TableCSS">
                    <tr id="Tr1" runat="server" class="TableHeader">
                        <td id="Td1" runat="server">OwnedBy &nbsp;</td>
                        <td id="Td2" runat="server">Sharedclass &nbsp;</td>
                        <td id="Td3" runat="server">EffectiveInterest &nbsp;</td>
                        <td id="Td4" runat="server">DeemedInterest &nbsp;</td>
                    </tr>
                    <tr id="ItemPlaceholder" runat="server">
                    </tr>
                </table>
            </LayoutTemplate>
<asp:listview>

CSS:

.TableCSS
        {
            border-bottom-width:thin;
            border-left-width:thin;
            border-bottom-color:Black;        

            background-color:Red;
            width:auto;
            }
        .TableHeader
        {
            border:12px;
            background-color:black;
            color:Snow;
            font-size:11px;
            font-family:Verdana;
            height:auto;
            text-align:center;
            }    

最佳答案

要查看表格行,请为表格设置背景并提供 cellspacing="1"(将 cellspacing 属性添加到您的表格标签)并为表格内的所有 TD 标签应用背景色。

关于asp.net - ListView 内带边框的表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10715089/

相关文章:

c# - GridView 的 DropDownList 过滤器不起作用

javascript - 样式化组件 : Global Colors Style Sheet

jquery - 获取字符串的值;在内容中找到这个字符串;感谢 jQuery 将新样式应用于此字符串

html - 使标题行和表格数据与水平滚动条协调移动

javascript - 为什么 ajax 请求会忽略 "Set-Cookie" header ?

.net - 在多个 DLL 中拥有命名空间有什么影响?

c# - DropDownList 不回发,即使设置了 AutoPostBack

javascript - 单击以删除 html 和 javascript

右侧带有箭头的 CSS3 按钮(中心)

c# - 单个 ASPX 页面 - 无代码隐藏 - 页面指令