GridView单元格合并问题 错误提示:必须在顶级静态类中定义扩展方法;GridViewExtensions 为嵌套类
public static class GridViewExtensions
{
public static GridView RowSpan(this GridView gridView, object field)
{
Dictionary<string, string> rowDictionary = ObjectLoadDictionary(field);
int columnIndex = int.Parse(rowDictionary["ColumnIndex"]);
string columnName = rowDictionary["ColumnControlID"];
string propertyName = rowDictionary["PropertyName"];
string columns = rowDictionary["Columns"];
for (var i = 0; i < gridView.Rows.Count; i++)
{
int rowSpanCount = 1;
for (int j = i + 1; j < gridView.Rows.Count; j++)
{
//绑定行合并处理
if (string.IsNullOrEmpty(columnName))
{
//比较2行的值是否相同
if (gridView.Rows[i].Cells[columnIndex].Text == gridView.Rows[j].Cells[columnIndex].Text)
{
//合并行的数量+1
rowSpanCount++;
//隐藏相同的行
gridView.Rows[j].Cells[columnIndex].Visible = false;
if (!string.IsNullOrEmpty(columns))
{