首页 > 代码库 > 在GridView中的每一页末尾添加空行

在GridView中的每一页末尾添加空行

原文发布时间为:2008-08-03 —— 来源于本人的百度文章 [由搬家工具导入]

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {    
        int numCol = GridView1.Columns.Count;
        int numRow = GridView1.Rows.Count;
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            GridViewRow gr = new GridViewRow(-1, -1, DataControlRowType.EmptyDataRow, DataControlRowState.Normal);
            for (int j = 0; j < numCol; j++)
            {
                TableCell cell = new TableCell();
                cell.Text = "&nbsp";
                gr.Cells.Add(cell);
            }
            GridView1.Controls[0].Controls.AddAt(numRow + 1, gr);
        }
    }

在GridView中的每一页末尾添加空行