日期:2014-05-17 浏览次数:20418 次
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
var row = e.Row;
if (row.RowType == DataControlRowType.DataRow)
{
var rec = (MyDataType)row.DataItem; //你的数据实体对象
if (rec.分组标题 != null)
{
row.Cells[0].ColumnSpan = GridView1.Columns.Count;
for (var i = 1; i < GridView1.Columns.Count; i++)
row.Cells[i].Visible = false;
row.Cells[0].Controls.Clear();
var lbl = new Label { Text = Server.HtmlEncode(rec.分组标题) };
row.Cells[0].Controls.Add(lbl);
lbl.Font.Size = new FontUnit(FontSize.Large);
lbl.Font.Bold = true;
}
}
}