This code is compressed to 100 rows, which is easy to expand and increase the number of controls. When I was working on a project last year, I met a module and needed to dynamically increase or decrease controls. The first solution was to use UpdatePanel for partial page updates. Because the page is large and there are many controls, it will become very slow when many controls are dynamically added. Later, I thought about using javascript for dynamic increase and decrease controls. Finally, When I submitted the page, I collected the data of the page controls. The effect was great. However, since it was only for that module, the scalability was poor, at that time, it was very complicated to write javascript code. To increase or decrease the result dynamically, more than 500 lines of javascript code were written.
Later, the code was rewritten when I was idle at the end of last year. Now the code is compressed into 100 rows, which is easy to expand and increase the number of controls and is easy to use.
:
A simple example:
The Code is as follows: