- You don't need to convert a string to a string(
TextBox.Text returns already a string).
How and where have you added the TextBox to the footer-row?
i added the TextBox to the footer row in GridView1_RowDataBound
RowDataBound isn't the right method for dynamic controls since it is called only on databinding and not on every postback. But dynamical controls need to be recreated on every postback.
So use RowCreated instead to create controls dynamically and use RowDataBound to databind them.
protected void GridView1_RowCreated(Object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Footer)
{
TextBox tb = new TextBox();
tb.ID = "accountID";
e.Row.Cells[indexOfColumn].Controls.Add(tb);
}
}
TextBox.Textreturns already a string). How and where have you added theTextBoxto the footer-row?