ASP.net Dynamically adding controls on Button press. Postback issue

前端 未结 2 619
醉酒成梦
醉酒成梦 2021-01-16 10:13

I have a user control which contains several buttons, depending on the button pressed a different control is added to the page (lets say button 1 adds a TextBox, button2 add

2条回答
  •  甜味超标
    2021-01-16 10:30

    I personally would handle this using a ListView. Include all of the controls you need in the ItemTemplate with Visible=false and bind them to a small list stored in the viewstate. Programatically set the correct control visible on row databind. Note you will have to collect your data in the controls and save it in your list before you rebind it.

提交回复
热议问题