zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    反射 元类
    多态
    封装
    继承
    面向基础
    包 logging模块 hashlib模块 openpyxl 深浅拷贝
    常用模块
    re模块(正则表达式)
    模块 导入方式 软件开发目录规范
    第 3 章 镜像
  • 原文地址:https://www.cnblogs.com/wujianwei/p/7064172.html
Copyright © 2011-2022 走看看