Add Another Footer to GridView

I came across this link to find out another approach to add another Footer to the GridView(or not show Footer)


protected void GridView1_OnPreRender(object sender, EventArgs e)
        if (GridView1.Controls.Count > 0 && GridView1.Controls[0].Controls.Count > 1)
// //public GridViewRow(
//    int rowIndex,
//    int dataItemIndex,
//    DataControlRowType rowType,
//    DataControlRowState rowState

GridViewRow gr = new GridViewRow(-1, -1, DataControlRowType.Footer, DataControlRowState.Normal);
TableCell cell = new TableCell();
cell.Text = "<hr style='color:yellow; height: 5px' />";
cell.Attributes["colspan"] = GridView1.Columns.Count.ToString(); //merge columns
//gr.Cells[0].HorizontalAlign = HorizontalAlign.Center;
GridView1.Controls[0].Controls.AddAt(GridView1.Controls[0].Controls.Count - 1, gr);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s