ASP.NET中GridView实现相同数据的单元格合并
实现代码
#region 合并单元格
protected void Unite(GridView gv)
{
int i;
string LastType1;
int LastCell;
if (gv.Rows.Count > 0)
{
for (int j = 0; j < 7; j++)
{
if (j < 1 || j > 4)
{
LastType1 = gv.Rows[0].Cells[j].Text;
gv.Rows[0].Cells[j].RowSpan = 1;
LastCell = 0;
for (i = 1; i < gv.Rows.Count; i++)
{
if (gv.Rows[i].Cells[j].Text == LastType1)
{
gv.Rows[i].Cells[j].Visible = false;
gv.Rows[LastCell].Cells[j].RowSpan++;
}
else
{
LastType1 = gv.Rows[i].Cells[j].Text;
LastCell = i;
gv.Rows[i].Cells[j].RowSpan = 1;
}
}
}
}
}
}
#endregion
最后
以上就是活力母鸡最近收集整理的关于ASP.NET中GridView实现相同数据的单元格合并的全部内容,更多相关ASP.NET中GridView实现相同数据内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复