G
gilly3
I need to be able to add form inputs to a form. A user can enter one item
and then click a link to add another.
So far I have a linkbutton the calls this function:
private void linkAddRow_Click(object sender, System.EventArgs e)
{
HtmlTableRow oNewRow = new HtmlTableRow();
HtmlTableCell oNewCell = new HtmlTableCell();
TextBox oNewTextBox = new TextBox();
oNewCell.Controls.Add(oNewTextBox);
oNewRow.Cells.Add(oNewCell);
oTable.Rows.Add(oNewRow);
}
It adds one row fine. But each additional time I click the link, I don't
get any more rows. Instead of generating a new row, it is only modifying
the existing object.
What approach should I use to dynamically add an unknown number of elements
to a page?
-ivan.
and then click a link to add another.
So far I have a linkbutton the calls this function:
private void linkAddRow_Click(object sender, System.EventArgs e)
{
HtmlTableRow oNewRow = new HtmlTableRow();
HtmlTableCell oNewCell = new HtmlTableCell();
TextBox oNewTextBox = new TextBox();
oNewCell.Controls.Add(oNewTextBox);
oNewRow.Cells.Add(oNewCell);
oTable.Rows.Add(oNewRow);
}
It adds one row fine. But each additional time I click the link, I don't
get any more rows. Instead of generating a new row, it is only modifying
the existing object.
What approach should I use to dynamically add an unknown number of elements
to a page?
-ivan.