In a Gridview, you can use the RowCreated event to completely "destroy" and recreate the header and/or footer. During this event, check to see:
if (e.Row.RowType = DataControlRowType.Header)
{
// At this point you have access to e.Row.Cells
// You can now empty the collection and recreate it.
// If you create a singular cell in the collection
// you can then make its ColumnSpan reach across
// the length of the entire table. Then inside this
// cell you can add any set of controls you want.
// I've used this method to combine column headers
// and add specialty controls that simply wouldn't
// working using the HeaderTemplate
}
Since this is done at RowCreated, during RowDataBound you would have access to these controls and can then manipulate them however you like based on data. This is handy for doing complicated calculations in the footer, adjusting images in the header based on sort, etc.