I want to add textbox to headerRow of first column in Gridview and than reference it in button click event. Unfortunatly this doesn't work, any suggestions. Thank you in advance
protected void gridView_RowCreated(object sender, GridViewRowEventArgs e)
{
TextBox tx10=new TextBox();
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[0].Controls.Add(tx10);
}
}
protected void btFilter_Click(object sender, EventArgs e)
{
TextBox tbx = (TextBox)gridView.HeaderRow.FindControl("tx10");
}
Reference dynamically added controls in HeaderRow gridview
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Anuja PawarRank #1,404 · 1.2K reputationPosted Dec 5, 2011, 8:56 PM EST
http://blogs.msdn.com/b/mattdotson/archive/2006/03/01/real-world-gridview-two-headed-grouping-gridviews.aspx