try this small demo..in it first footer is added design time and second footer is added dynamicaly....then try to implement in ur code
.aspx file is
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" ShowFooter="True" runat="server" Width="421px"
onrowdatabound="GridView1_RowDataBound" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<%# Eval("name") %>
</ItemTemplate>
<FooterTemplate>
foot one
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</form>
</body>
.cs file is as follow..
.in GridView1_RowDataBound in cell i textbox is added dynamicaly runtime by merging secound column in it
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
bind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow gvr = e.Row;
if (e.Row.RowType == DataControlRowType.Footer)
{
int index = GridView1.Rows.Count;
GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Footer, DataControlRowState.Normal);
TableCell cell = new TableCell();
TextBox txt = new TextBox();
txt.Width = 350;
cell.Controls.Add(txt);
TableCell cell2 = new TableCell();
row.Cells.Add(cell);
row.Cells.Add(cell2);
row.Cells[0].ColumnSpan = 3;
row.Cells[1].Visible = false;
GridView1.Controls[0].Controls.Add(row);
}
}
private void bind()
{
DataTable table = new DataTable();
table.Columns.Add("name");
DataRow dr = table.NewRow();
dr["name"] = "rowa";
table.Rows.Add(dr);
DataRow dr2 = table.NewRow();
dr2["name"] = "rowa";
table.Rows.Add(dr2);
this.GridView1.DataSource = table;
this.GridView1.DataBind();
}
hope it will help u