欢迎访问我的博客 https://javascript.shop

在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);
        }
    }

posted @ 2017-07-10 00:48  孑孓子  阅读(150)  评论(0编辑  收藏  举报
欢迎访问我的博客 https://javascript.shop