I got annoyed that I had to use foreach or use the OnItemCreated event to access the footer. If I can just have a simple form where I add rows, I could integrate the form into the grid by using footer. Why loop when you can access directly?
// Header access
System.Web.UI.Control header = MyDataGrid.Controls.Controls;
// Footer access
System.Web.UI.Control footer = MyDataGrid.Controls.Controls[MyDataGrid.Controls.Controls.Count - 1];
// if you know that "Whatever" is a button, and you want to directly access it's Text property: