您的位置:首页 > 其它

扩展GridView控件(11) - 合并指定列的相邻且内容相同的单元格

2007-09-03 08:21 435 查看
GridView既强大又好用。为了让它更强大、更好用,我们来写一个继承自GridView的控件。

[索引页]

[源码下载]

[align=center]扩展GridView控件(11) - 合并指定列的相邻且内容相同的单元格 [/align]

作者:webabcd

介绍

扩展GridView控件:

合并指定列的相邻且内容相同的单元格

使用方法(设置属性):

MergeCells - 需要合并单元格的列的索引(用逗号“,”分隔)

关键代码

实现“合并指定列的相邻且内容相同的单元格”功能的代码

using System;

using System.Collections.Generic;

using System.Text;

using System.Web.UI.WebControls;

using System.Web.UI;

namespace YYControls.Helper

上面的MergeCells(GridView gv, int[] columnIndices)方法用于实现“合并指定列的相邻且内容相同的单元格”,第一个参数是GridView,第二个参数是需要合并单元格的列的索引(用逗号“,”分隔)。

为GridView新增一个属性

using System;

using System.Collections.Generic;

using System.Text;

using System.ComponentModel;

namespace YYControls

继承YYControls.SmartGridViewFunction.ExtendFunction抽象类,重写其Execute()方法

using System;

using System.Collections.Generic;

using System.Text;

using System.Web.UI.WebControls;

namespace YYControls.SmartGridViewFunction

OK

[源码下载]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: