By handling RowDataBound() event of the gridview you can find Textbox control inside header template.
protected void gdv_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (gdv.HeaderRow != null)
{
TextBox txt = (TextBox)gdv.HeaderRow.FindControl("txt");
}
}