Repeater合并单元格

<asp:Repeater runat="server" ID="rptInfo"> <HeaderTemplate> <table cellpadding="0" cellspacing="0" border="1" bordercolor="black" width="100%" style="border-collapse:collapse; border-style:solid;" mce_style="border-collapse:collapse; border-style:solid;"> <tr> <td>科室名称</td> <td>出诊医生</td> <td>职称</td> <td>诊病人数</td> <td>挂号价格</td> <td>挂号金额</td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td runat="server" id="tdDepName"><%#Eval("dep_name")%></td> <td><%#Eval("doctor_name")%></td> <td><%#Eval("title_name")%></td> <td><%#Eval("register_person")%></td> <td><%#Eval("price")%></td> <td><%#Eval("total_money")%></td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater>

 

for (int i = rptInfo.Items.Count - 1; i > 0; i--) { HtmlTableCell oCell_previous = rptInfo.Items[i-1].FindControl("tdDepName") as HtmlTableCell; HtmlTableCell oCell = rptInfo.Items[i].FindControl("tdDepName") as HtmlTableCell; oCell.RowSpan = (oCell.RowSpan == -1) ? 1 : oCell.RowSpan; oCell_previous.RowSpan = (oCell_previous.RowSpan == -1) ? 1 : oCell_previous.RowSpan; if (oCell.InnerText == oCell_previous.InnerText) { oCell.Visible = false; oCell_previous.RowSpan += oCell.RowSpan; } }

你可能感兴趣的:(server,table,asp,border)