I add one row to gridview dynamically, and also i want to add one more row to that and want to display all the rows ata atime.. how can i add rows to gridview dynamically..
A:
Try this if u r using asp.net n C# :
ChildTable table = GridView1.Rows[index].Parent as ChildTable; //get that row
if (table != null)
{
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
TableCell cell = new TableCell();
cell.ColumnSpan = GridView1.Columns.Count;
cell.Width = Unit.Percentage(100);
cell.Controls.Add(new LiteralControl("New Row"));
row.Cells.Add(cell);
table.Rows.Add(row);
}
Thanks,
Access Denied
2009-11-25 11:05:36
Please edit and use the code tag to make the post more redable
kevchadders
2009-11-25 11:07:57
You get a -1 for not writing english. "u", "r" and "n" are not wnglish words.
sindre j
2009-11-25 11:16:20