老师给我出了个题目是GRIDVIEW的单元格合并 哪位大神知道怎么合并吗? public static void GroupRows(GridView GridView1, int cellNum, int startNum, int endNum) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 之前在一个项目中用到的方法,希望对你有帮助 /// <summary> /// 合并列相同内容的单元格,并添加颜色 /// </summary> /// <param name="GridView1"></param> /// <param name="cols"></param> public static void GroupCol(GridView GridView1, int cols) { for (int j = 1; j < cols; j++) { TableCell oldTc = GridView1.Rows[0].Cells[j]; for (int i = 1; i < GridView1.Rows.Count; i++) { TableCell tc = GridView1.Rows[i].Cells[j]; if (oldTc.Text == " ") { oldTc = tc; } else { if (oldTc.Text == tc.Text) { tc.Visible = false; if (oldTc.RowSpan == 0) { oldTc.RowSpan = 1; } oldTc.RowSpan++; oldTc.VerticalAlign = VerticalAlign.Middle; oldTc.Attributes.Add("style", "background-color:#C8BA0D;"); } else { oldTc.Attributes.Add("style", "background-color:#C8BA0D;"); oldTc = tc; } } } } } 求ASP.NET分页代码 不是用存储过程写的 讨论下.net 的MVC 做一个登陆界面,Login.aspx 程现在客户端的页面的javascript变量有可能会被用户更改吗? ASP.NET问题(与数据库做连接) DataTable更新数据库记录 关于存储过程 100分,Ajax方法中如何使用服务器控件 奇怪,asp.net中在类中定义的一个字符型的字段,而我想在某的方法中改它的值,改不了????(看代码) 请教高手 求一个正划表达式。匹配<body>中的内容 Developer Express 中TreeList 全选按钮回调问题
/// <summary>
/// 合并列相同内容的单元格,并添加颜色
/// </summary>
/// <param name="GridView1"></param>
/// <param name="cols"></param>
public static void GroupCol(GridView GridView1, int cols)
{
for (int j = 1; j < cols; j++)
{
TableCell oldTc = GridView1.Rows[0].Cells[j];
for (int i = 1; i < GridView1.Rows.Count; i++)
{
TableCell tc = GridView1.Rows[i].Cells[j];
if (oldTc.Text == " ")
{
oldTc = tc;
}
else
{ if (oldTc.Text == tc.Text)
{
tc.Visible = false;
if (oldTc.RowSpan == 0)
{
oldTc.RowSpan = 1;
}
oldTc.RowSpan++;
oldTc.VerticalAlign = VerticalAlign.Middle;
oldTc.Attributes.Add("style", "background-color:#C8BA0D;");
}
else
{
oldTc.Attributes.Add("style", "background-color:#C8BA0D;");
oldTc = tc;
}
}
}
}
}