first footer row getting invisible..why?

Posted by Oswaldlily under ASP.NET on 6/6/2013 | Points: 10 | Views : 840 | Status : [Member] | Replies : 0
I have linkAdd in last column of footer row..On clicking I need another row of same as first row..

Problem: When added second row in footer,first footer row getting disppear ..why?


protected void lnkAdd_NewRow_click(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Footer, DataControlRowState.Normal);
DropDownList ddl1 = (DropDownList)gv.FooterRow.FindControl("ddl1");
DropDownList ddl2 = (DropDownList)gv.FooterRow.FindControl("ddl2");
Textbox txtbox =(TextBox)gv.FooterRow.FindControl("txtbox");

for (int j = 0; j < gv.Columns.Count; j++)
{
TableCell cell = new TableCell();
if (j == 2)
cell.Controls.Add(ddl1);
else if (j == 3)
cell.Controls.Add(ddl2);
else if (j == 4)
cell.Controls.Add(txtbox);

row.Cells.Add(cell);
}
//((Table)gv.Controls[0]).Rows.Add(row);
gv.ShowFooter = true;
gv.Controls[0].Controls.AddAt(gv.Rows.Count + 2, row);
}
}




Responses

(No response found.)

Login to post response