• repeater合并单元格


    前端

     <td id="td_VisitCount" runat="server"> <%# Eval("VisitCount")%> </td>

    后台:

    绑定数据后,比较是否相等然后再设置RowSpan的属性第一行占用的行数,并把与其相等的隐藏起来

         rptData.DataSource = data;
            rptData.DataBind();
            for (int i = rptData.Items.Count - 1; i > 0; i--)
            {
                HtmlTableCell oCell_Previous = rptData.Items[i - 1].FindControl("td_VisitCount") as HtmlTableCell;
                HtmlTableCell oCell = rptData.Items[i].FindControl("td_VisitCount") 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;
                }
            }

    参考博客:http://www.cnblogs.com/LifeKingcn/archive/2012/12/20/2826627.html

  • 相关阅读:
    Tomcat启动流程简析
    Tomcat的启停脚本源码解析
    Servlet规范
    CCNA
    CCNA-Part 6
    MYSQL 使用基础
    CCNA-Part5
    CCNA-Part4 -网络层
    MySQL 字符串索引优化方案
    CCNA-Part3
  • 原文地址:https://www.cnblogs.com/wujianwei/p/7064172.html
Copyright © 2020-2023  润新知