My C# web app requires the user to enter automobile information. The user can add information for one auto, or more (max 20).
My page has these text fields: Car Number, Car Make, Car Year, Mileage, VIN
I have a button that allows the user to “Add More Cars”
The idea is to allow the user to add more than one car.
When the user clicks “Add More Cars”, how can I dynamically display the text boxes, and keep track of how many cars the user has added (in order to load them to an array and write to database)
Any other ideas that would make this objective easier? The control will only be used to enter data, not to view any records.
I like using a placeholder and adding user controls. It works quite nicely and is pretty modular. Here is a quick example where I add a few controls based on a list. You will notice I pass an object to my user control, allowing it to hide or show itself, display certain options etc based on permissions. You could easily modify this code to add upon an event: