Below is the code through which you can add text box to GridView. This is dynamic approach and can be used in scenario where you don’t have information about data columns at design time. But if you have information about data column at design time go with Template column approach.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
for(int i =0; i < e.Row.Cells.Count; i++)
{
TextBox txt = new TextBox();
txt.Text = e.Row.Cells[i].Text;
e.Row.Cells[i].Text = "";
e.Row.Cells[i].Controls.Add(txt);
}
}
}
Please let me know if it works for you.