码迷,mamicode.com
首页 > Web开发 > 详细

asp.net table/gridview 合并列

时间:2016-01-25 10:00:26      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:

        public void MergeCell(TableRow trow)
        {
            TableCell currentCell = trow.Cells[0];
            TableCell prevCell = null;
            for (var i = 0; i < trow.Cells.Count; i++)
            {
                currentCell = trow.Cells[i];
                if (prevCell != null && currentCell.Text == prevCell.Text)
                {
                    prevCell.ColumnSpan = (prevCell.ColumnSpan == 0 ? 1 : prevCell.ColumnSpan) + 1;
                    currentCell.Visible = false;
                }
                else
                {
                    prevCell = currentCell;
                }
            }
        }

 

asp.net table/gridview 合并列

标签:

原文地址:http://www.cnblogs.com/thirties/p/5156564.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!