html文件:
<asp:Repeater ID="rptEmployee" runat="server">
<HeaderTemplate>
<table border="" cellpadding="" cellspacing=""><tr><td>省份</td><td>城市</td></tr>
</HeaderTemplate>
<ItemTemplate>
<tr><td runat="server" id="divProName"><%#Eval("FirstName")%></td><td><%#Eval("LastName")%></td></tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater> 后台文件:
C#版:
private void BindData()
{
this.rptEmployee.DataSource = DBHelper.GetExecuteDataSet("select FirstName,LastName from dbo.Employees group by firstName,LastName", null);
this.rptEmployee.DataBind();
for (int i = this.rptEmployee.Items.Count - ; i > ; i--)
{
HtmlTableCell oCell_pre = this.rptEmployee.Items[i - ].FindControl("divProName") as HtmlTableCell;
HtmlTableCell oCell = rptEmployee.Items[i].FindControl("divProName") as HtmlTableCell;
oCell.RowSpan = oCell.RowSpan == - ? : oCell.RowSpan;
oCell_pre.RowSpan = oCell_pre.RowSpan == - ? : oCell_pre.RowSpan;
if (oCell.InnerHtml==oCell_pre.InnerHtml)
{
oCell.Visible = false;
oCell_pre.RowSpan += oCell.RowSpan;
}
}
}
VB版:
Private Sub BindData()
Me.rptEmployee.DataSource = DBHelper.GetExecuteDataSet("select EmployeeID, LastName, FirstName from Employees order by firstName,EmployeeID desc", Nothing)
Me.rptEmployee.DataBind() For i As Integer = Me.rptEmployee.Items.Count - To Step -
Dim cell_pre, cell As HtmlTableCell
cell_pre = Me.rptEmployee.Items(i - ).FindControl("divProName") '上一行
cell = Me.rptEmployee.Items(i).FindControl("divProName") '当前行 If cell.RowSpan = - Then
cell.RowSpan = '当前行没有合并行,则当行不用合并
Else
cell.RowSpan = cell.RowSpan '当行的合并行,等于当前的已经合并的行数
End If If cell_pre.RowSpan = - Then
cell_pre.RowSpan =
Else
cell_pre.RowSpan = cell_pre.RowSpan
End If If (cell_pre.InnerText = cell.InnerText) Then
cell.Visible = False
cell_pre.RowSpan += cell.RowSpan
End If
Next End Sub

Reapter合并行的更多相关文章

  1. Vim常用操作-合并行。

    刚接触 Vim 会觉得它的学习曲线非常陡峭,要记住很多命令.所以这个系列的分享,不会教你怎么配置它,而是教你怎么快速的使用它. 在开发时为了代码美观,经常会把属性用换行的方式显示. <el-di ...

  2. easyui生成合并行,合计计算价格

    easyui生成合并行,合计计算价格 注:本文来源: 原创 一:图样你效果图 二:代码实现 1:datagrid 列展示: window.dataGrid = $("#dataGrid&qu ...

  3. sed行处理详解(交换行,合并行,删除行等)

    1.合并行 zj@zj:~/Script/blog_script$ cat test11234合并上下两行zj@zj:~/Script/blog_script$ sed '$!N;s/\n/\t/' ...

  4. 【editplus经常用的快捷键】Editplus 选中一行ctrl+r,Edit 合并行 Ctrl+Shift+J 合并选定行 删除当前行

    Editplus 选中一行: ctrl+rEditplus 复制一行: ctrl+r选择行,然后ctrl+c复制.复制一行到下一行中:Editplus有:Ctrl+j 复制上一行的一个字符到当前行Ed ...

  5. mysql 行变列(多行变成一行/多行合并成一行/多行合并成多列/合并行)

    数据库结构如图: 而我想让同一个人的不同成绩变成此人在这一行不同列上显示出来,此时分为2中展现: 第一种展现如图----[多行变一列](合并后的数据在同一列上): sql如下: select name ...

  6. easyui-datagrid自动合并行

    1.目标 1.1表格初始化完成后,已经自动合并好需要合并的行: 1.2当点击字段排序后,重新进行合并: 2.实现 2.1 引入插件 /** * author ____′↘夏悸 * create dat ...

  7. js合并行

    网上找了好久才找到,在这记录下. <script type="text/javascript" > function MergerRow(ID) { var tab = ...

  8. NPOI:处理xls文件中的合并行

    /// <summary> /// NPOI根据路径获取文件转换成DataTable /// </summary> /// <param name="FileP ...

  9. React 合并行 RowSpan

    十年河东,十年河西,莫欺少年穷 学无止境,精益求精 今儿分享一篇关于React Table 组件合并单元行的方法! 实例效果如下: 原则就是遇到相同的供方名称,就要做行合并! 思路如下:后端计算合并的 ...

随机推荐

  1. ng-model和ng-bind区别

    ng-bind has one-way data binding ($scope --> view). It has a shortcut {{ val }} which displays th ...

  2. Ueditor 1.4.3.1 使用 ThinkPHP 3.2.3 的上传类进行图片上传

    在 ThinkPHP 3.2.3 中集成百度编辑器最新版 Ueditor 1.4.3.1,同时将编辑器自带的上传类替换成 ThinkPHP 3.2.3 中的上传类. ① 下载编辑器(下载地址:http ...

  3. PHP关于依赖注入(控制反转)的解释和例子说明

    PHP关于依赖注入(控制反转)的解释和例子说明 发表于2年前(2014-03-20 10:12)   阅读(726) | 评论(1) 8人收藏此文章, 我要收藏 赞2 阿里云双11绽放在即 1111 ...

  4. .gitignore文件不起作用

    当我们用git时常常会习惯把我们不想上传到远程代码库中的一些本地文件(夹)放在一个叫做.gitignore的文件中,例如常见的本地build文件夹,一些IDE如Intellig,Eclipse的项目管 ...

  5. javaWeb中servlet开发(3)——Servlet生命周期

    生命周期:是一个程序的存在周期,servlet由于是受容器的管理,所以容器来决定其生命周期 1.servlet生命周期 2.servlet生命周期对应的方法 3.servlet生命周期代码 publi ...

  6. Boyer-Moore algorithm

    http://www-igm.univ-mlv.fr/~lecroq/string/node14.html Main features performs the comparisons from ri ...

  7. Wysiwyg Editors 标签过滤

    针对October CMS编辑器插件取消自动过滤DIV标签开关: 找到modules\backend\formwidgets\richeditor\assets\vendor\redactor\red ...

  8. 通过 Chrome Workspace 调试本地项目(修改样式时及时保存)

    打开 DevTools 开发者工具[F12]中的 Sources 面板,在面板左侧右键选择「Add folder to workspace」,选择添加的文件夹. 添加好后,右键一个文件,选择「Map ...

  9. class-dump + DumpFrameworks.pl

    目的:实现生成 private framework 的 .h,以便倒入项目使用私有 api. 一.class-dump 下载地址: http://stevenygard.com/download/ 安 ...

  10. js鲸鱼

    <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ...