protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
e.Row.CssClass = "tdfont";
if (e.Row.RowType == DataControlRowType.Header)
{
TableCellCollection tcHeader = e.Row.Cells;
tcHeader.Clear();
string s1 = Request.QueryString["b"].ToString();
string[] s2 =
{
"流程","前期","招标文件","开标前","后期</th></tr><tr>",
"<a href=\"zbjy.aspx?a=" + Hdf1.Value + "&b=a31&c=1&d=评价意见&e="+Label1.Text+"\">评价意见</a>",
};//数组声明结束
for (int i = 0; i < s2.Length; i++)
{
tcHeader.Add(new TableHeaderCell());
tcHeader[i].Text = s2[i];
switch (i)
{
case 0:
tcHeader[i].CssClass = "gd1"; break;
case 7:
case 8:
case 9:
tcHeader[i].CssClass = "gdbig"; break;
default: tcHeader[i].CssClass = "gdmiddle"; break;
}
}
Label4.Text = "资格后审,正常程序";
tcHeader[0].Attributes.Add("rowspan", "2"); //跨Row
tcHeader[1].Attributes.Add("colspan", "5");
tcHeader[2].Attributes.Add("colspan", "6");
tcHeader[3].Attributes.Add("colspan", "3");
tcHeader[4].Attributes.Add("colspan", "11");
}
}
在绑定的时候,需要动态创建绑定列。
用GridView的RowDataBound事件