如何在gridview中每10行记录后增加一个空行?

来源:互联网 发布:亿钻网淘宝互刷平台 编辑:程序博客网 时间:2024/05/21 07:00
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex >0 && (e.Row.RowIndex+1) % 10 == 0)
{
GridViewRow newRow = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal);
newRow.Cells.Add(new TableCell());
newRow.Cells[0].ColumnSpan = e.Row.Cells.Count;
newRow.Cells[0].Text = " ";
this.GridView1.Controls[0].Controls.Add(newRow);
}
}
 我只补充一个填充行的背景色就很完善了。
newRow.Cells[0].BackColor = System.Drawing.Color.White;
原创粉丝点击