在做数据绑定显示的时候,经常会遇到这样的情况,使用一些asp.net web数据库控件,如Repeater、FormView等,里面的模板里使用table,还有可能是多个数据控件嵌套,里面有多个table,这样就能显示各种复杂的表格,但是table表格的边框线,就是一个问题,经常会遇到边线重复,就造成边线加粗的情形,怎么解决?
先总结一下,备忘:
<style type="text/css">
body
{
font-size: 12px;
}
td
{
font-size: 12px; height: 20px; line-height: 20px; height:20px;
}
.table
{
border-right: black 1px solid;
border-bottom: black 1px solid;
}
.table td
{
border-top: black 1px solid;
border-left: black 1px solid;
}
</style>
<asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" DataSourceID="SqlDataSource1"
Width="100%" Font-Size="Medium">
<ItemTemplate>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="100%" class="table" cellpadding="0" cellspacing="0">
<tr>
<td align="center" style="font-weight: bold; height: 30px; width: 3%">
单位
</td>
<td align="center" colspan="5" style="width: 97%">
<asp:Label ID="lbldw" runat="server" Text='<%#Eval("单位") %>'></asp:Label>
</td>
</tr>
<tr>
<td align="center" style="font-weight: bold; height: 30px; width: 10%">
检查时间
</td>
<td align="center" colspan="2">
<asp:Label ID="lbljcsj" runat="server" Text='<%#ConvertTime(Eval("检查时间").ToString()) %>'></asp:Label>
</td>
<td align="center" style="font-weight: bold; height: 30px; width: 10%">
检查内容
</td>
<td align="center" colspan="2">
<asp:Label ID="lbljcnr" runat="server" Text='<%#Eval("检查内容") %>'></asp:Label>
</td>
</tr>
<tr>
<td align="center" style="font-weight: bold; height: 30px; width: 10%">
参加人员
</td>
<td align="center" colspan="5">
<asp:Label ID="lblcjry" runat="server" Text='<%#Eval("参加人员") %>'></asp:Label>
</td>
</tr>
<tr>
<td align="center" style="font-weight: bold; height: 30px; width: 10%">
隐患登记
</td>
<td align="center" colspan="5">
<asp:Label ID="lblyhdj" runat="server" Text='<%#Eval("隐患登记") %>'></asp:Label>
</td>
</tr>
<tr>
<td align="center" style="font-weight: bold; height: 30px; width: 3%">
序号
</td>
<td align="center" style="font-weight: bold; height: 30px; width: 14%">
隐患部位
</td>
<td align="center" style="font-weight: bold; height: 30px; width: 34%">
隐患内容
</td>
<td align="center" style="font-weight: bold; height: 30px; width: 14%">
整改责任人
</td>
<td align="center" style="font-weight: bold; height: 30px; width: 14%">
限定日期
</td>
<td align="center" style="font-weight: bold; height: 30px; width: 19%">
完成情况
</td>
</tr>
<tr>
<td align="center" id="One_td1" runat="server">
</td>
<td align="center" id="Two_td1" runat="server">
</td>
<td align="center" id="Three_td1" runat="server">
</td>
<td align="center" id="Four_td1" runat="server">
</td>
<td align="center" id="Five_td1" runat="server">
</td>
<td align="center" id="Six_td1" runat="server">
</td>
</tr>
<tr>
<td align="center" style="font-weight: bold; height: 30px; width: 10%">
备注
</td>
<td align="center" colspan="5">
<asp:Label ID="lblbz" runat="server" Text='<%#Eval("备注") %>'></asp:Label>
</td>
</tr>
<tr>
<td align="center" style="font-weight: bold; height: 30px; width: 10%">
单位负责人
</td>
<td colspan="2" align="center">
<asp:Label ID="lbldwfzr" runat="server" Text='<%#Eval("单位负责人") %>'></asp:Label>
</td>
<td align="center" style="font-weight: bold; height: 30px; width: 10%">
记录
</td>
<td colspan="2" align="center">
<asp:Label ID="lbljlr" runat="server" Text='<%#Eval("记录人") %>'></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
<PagerStyle BorderColor="White" />
<RowStyle BorderColor="White" />
</asp:FormView>效果图如下:
