I have added controls dynamically to a table in ASP .NET by letting user enter the required no of rows. The sample code of the addRow() function is:
HtmlTableCell cell_1 = new HtmlTableCell();
HtmlTableCell cell_2 = new HtmlTableCell();
l = new Label();
nomenclature = new TextBox();
unit = new TextBox();
row[i] = new HtmlTableRow();
label.Text = "" +(i+ 1);
cell_1.Controls.Add(l);
row[i].Controls.Add(cell_1);
nomenclature.TextMode = TextBoxMode.MultiLine;
nomenclature.Rows = 5;
nomenclature.Columns = 40;
nomenclature.ID="nomenclature"+i;
nomenclature.Text = "NA";
cell_2.Controls.Add(nomenclature);
row[i].Controls.Add(cell_2);
table_items.Controls.Add(row[i]);
Now after successfully adding the rows, when i refresh the page and again try to add new Rows, It gives me sameID 'nomenclature0' error.
Please help me regarding this,
Thanks in Advance,