0
I think i am not being very clear. I have a drop down list and if i select a item and click the button, it should add a row to the exiting table. Next time when i select one more item from the drop down list and click the button, it should append the row. I have this following code which is adding a row with 9 columns at the first button click.but for the next button click , it is over writing on the previously added row. please help me out.
protected void btnOK_Click(object sender, EventArgs e)
{
TableRow tr = new TableRow();
TableCell firstcell = new TableCell();
TextBox firstcelltxtbox = new TextBox();
firstcelltxtbox.Text = this.ddlDepartments.Text;
firstcell.Controls.Add(firstcelltxtbox);
tr.Cells.Add(firstcell);
//add cells to the new row
for (int i = 0; i < 8; )
{
TableCell tc = new TableCell();
TextBox txtbox = new TextBox();
tc.Controls.Add(txtbox);
tr.Cells.Add(tc);
i++;
}
// add row to the existing table
this.TableMyTimeSheet.Rows.Add(tr);
} 0
Thanks Nikhil,
Can you please let me know how to add just one row with 9 columns each time i click the button.
Thanks,
Ramya