Programatically add controls
-
Hi! I need some help. I have a web control that has Labels with text set to Monday Tuesday etc. Beneath these labels are textboxes. I also have a button with the text "Add". When I click the add button a new row of textboxes should be places beneath the already existing ones. How can I go about reaching this? thank you!!
Illegal Operation
-
Hi! I need some help. I have a web control that has Labels with text set to Monday Tuesday etc. Beneath these labels are textboxes. I also have a button with the text "Add". When I click the add button a new row of textboxes should be places beneath the already existing ones. How can I go about reaching this? thank you!!
Illegal Operation
If the maximum number of rows possible is quite less, then place all the textboxes in the rows at design time (with display set to none). Then, on click of the add button, just change the display through javascript. If there is no limit or a high limit for the maximum number of textboxes possible, add them dynamically using TextBox class through code behind.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
-
Hi! I need some help. I have a web control that has Labels with text set to Monday Tuesday etc. Beneath these labels are textboxes. I also have a button with the text "Add". When I click the add button a new row of textboxes should be places beneath the already existing ones. How can I go about reaching this? thank you!!
Illegal Operation
What is the container control that you have? If you are using a gridview then add a footer row and show it when you click the Add row button. This off-course is the simplest way to do it but would work for only one row at a time, i.e. you can have only one footer row per gridview. Continuing with gridview, if you need more rows and assuming you are using bound columns, just add an empty row to your data source and refresh the binding. Again very simple to do. If you are not using a gridview and assuming you use HTML tables, then your table should be visible on the server and you need to generate and insert HTML script, which can get a bit clumsy at times.