Posted on: 11/6/2013 5:00:49 PM | Views : 783

I am trying to dynamically add fields and associated labels to a form using a submit button, but for some reason I cannot get it to work. It partially works, but for some reason I cannot figure out how to make it stop overwriting the first textbox and label with the new one. This is what I have so far:
protected void addLineControl(object sender, EventArgs e) { // Increase the number added and add the new label and textbox TotalNumberAdded++; AddControls(TotalNumberAdded); } private void AddControls(int rowCounter) { // Convert 'rowCounter' to string string counter = rowCounter.ToString(); // Create new Label var newLabel = new Label(); newLabel.ID = "lbl_" + counter; newLabel.Text = "lbl_" + counter; // Create new TextBox var new ...

Go to the complete details ...