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

    技术2022-05-11  77

    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;

    最新回复(0)