English 中文(简体)
列表视图内有边框的表格
原标题:table with borders inside listview
  • 时间:2012-05-23 07:10:25
  •  标签:
  • asp.net
  • css

我希望有边界的表格在列表视图中显示。 我在列表视图中使用了 html 表格, 但我无法获得边界线( rows) 和 列 ( triged 边框= “ 2 ” ) 。 我试图使用 cs 来获取边界, 但我无法获取表格行 。

代码 :

<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;
            }    
最佳回答

要查看表格行, 请为表格设置背景, 并给出单元格间隔=" 1" (将单元格间隔属性添加到表格标签), 并对表格中的所有 TD 标记应用背景颜色 。

问题回答

Notice that the class you gave the table is not the same as what you declared in your css (i.e. class="Table" VS .TableCSS) Also, you can declare a header for each column with <th>.

Inside <td> hard code the styling as: style="border: thin solid #C0C0C0". Change the border color as you want.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签