gridview合并单元格
记录用,以前写过,忘记了
转自:http://marss.co.ua/MergingCellsInGridView.aspx
public class GridDecorator
{
public static void MergeRows(GridView gridView)
{
for (int rowIndex = gridView.Rows.Count - 2; rowIndex >= 0; rowIndex--)
{
GridViewRow row = gridView.Rows[rowIndex];
GridViewRow previousRow = gridView.Rows[rowIndex + 1]; for (int i = 0; i < row.Cells.Count; i++)
{
if (row.Cells[i].Text == previousRow.Cells[i].Text)
{
row.Cells[i].RowSpan = previousRow.Cells[i].RowSpan < 2 ? 2 : previousRow.Cells[i].RowSpan + 1;
previousRow.Cells[i].Visible = false;
}
}
}
}
}
protected void gridView_PreRender(object sender, EventArgs e)
{
GridDecorator.MergeRows(gridView);
}
gridview合并单元格的更多相关文章
- webform gridview合并单元格
gridview合并单元格 由于项目要求,需要合并某些单元格,因此特意封装了如下帮助类: /// <summary> /// 合并单元格 /// </summary> publ ...
- gridview 合并单元格 并原样导出数据
使用的方式都是比较简单的,asp.net 如何进行数据的导出有好多种方法,大家可以在网上找到, 一下提供一些合并并原样输出的一个简单的代码: public void ToExcel(System.We ...
- DEV gridview 合并单元格
private void gv_docargo_CellMerge(object sender, DevExpress.XtraGrid.Views.Grid.CellMergeEventArgs e ...
- gridview 合并单元格后,选中颜色重新绘制
gv_docargo.RowStyle += OnRowStyle; private void OnRowStyle(object sender, DevExpress.XtraGrid.Views. ...
- GRIDVIEW多行多列合并单元格(合并列)
GitHub项目地址:https://github.com/mingceng/merge-gridviewcell 去年的时候,我写了两篇文章: GridView多行多列合并单元格(完整代码和例子) ...
- GridView中合并单元格
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Da ...
- GridView相同内容合并单元格
using System;using System.Data;using System.Configuration;using System.Collections;using System.Web; ...
- Repeater多列分别合并单元格
GridView.Repeater合并单元格可以参考http://www.cnblogs.com/zhmore/archive/2009/04/22/1440979.html,但是原文例子是合并一列的 ...
- .Net用字符串拼接实现表格数据相同时合并单元格
前言 最近在做项目通过GridView或Repeater绑定数据,如果两行或若干行某列值相同,需要进行合并单元格,但是实现过程中想到了字符串拼接,于是就没用绑定数据控件,而是用了html结合字符串实现 ...
随机推荐
- 破坏之王——ddos攻击与防范 读书笔记
好久没写博客了,最近把绿盟的<破坏之王——ddos攻击与防范>又翻了一下,整理了关于DDOS分类和原理的xmind图~~ 百度云盘:http://pan.baidu.com/s/1i3ms ...
- python 操作mongodb数据库模糊查询
# -*- coding: utf-8 -*-import pymongoimport refrom pymongo import MongoClient #创建连接#10.20.66.106clie ...
- SpringMVC的controller方法中注解方式传List参数使用@RequestBody
在SpringMVC控制器方法中使用注解方式传List类型的参数时,要使用@RequestBody注解而不是@RequestParam注解: //创建文件夹 @RequestMapping(value ...
- POj 2186 Popular Cows[连通分量]
题目大意:给出N头牛,有M种关系u, v.代表u牛崇拜v牛.要求找出有多少头牛被所有牛崇拜着题目链接:http://poj.org/problem?id=2186解题思路:1>求出强连通分量,标 ...
- PHP漏洞全解(一)-PHP网站的安全性问题
本文主要介绍针对PHP网站常见的攻击方式,包括常见的sql注入,跨站等攻击类型.同时介绍了PHP的几个重要参数设置.后面的系列文章将站在攻击者的角度,为你揭开PHP安全问题,同时提供相应应对方案. 针 ...
- 判断数据库表字段是否为null值,采用is null
use UserCentergo select * from AccountDetails1.判断一个字段是否为null值,进行查询:update AccountDetails set Project ...
- var a=[]; 和 var a=new Array(); 的区别,为什么前者效率高
因为 JSON格式的语法是引擎直接解释的.而new Array 则需要调用Array的构造器.还有就是1.当你需要将一个数字转化为字符串时可以这样定义:var s=""+1; 这样 ...
- php 使用jquery实现ajax
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- 徐汉彬:Web系统大规模并发——电商秒杀与抢购
[导读]徐汉彬曾在阿里巴巴和腾讯从事4年多的技术研发工作,负责过日请求量过亿的Web系统升级与重构,目前在小满科技创业,从事SaaS服务技术建设. 电商的秒杀和抢购,对我们来说,都不是一个陌生的东西. ...
- Qt中QString,int,char,QByteArray之间相互转换
http://blog.csdn.net/ymc0329/article/details/7284514 int 转 QString int m=1; QString b; b=QString::n ...