开发者

Dynamically adding a textbox to a panel on button click

开发者 https://www.devze.com 2022-12-16 02:50 出处:网络
I just don\'t understand how this is done. I\'ve gone through several questio开发者_如何学JAVAns here and from a few other websites.

I just don't understand how this is done. I've gone through several questio开发者_如何学JAVAns here and from a few other websites.

Basically, a company will be adding process steps, and I want there to be a textbox with a button next to it that reads "Add another step." Once clicked, a new textbox will appear beneath the current one, and the button will be moved next to the new text box. What do I need to do?


Well things will get a little more complex once you ask how to maintain ViewState. However, since you didn't ask that (yet), the simple answer is just that on button click event you should instantiate a new TextBox and Insert it into the Controls before the Button.


Okay, finally found an answer I can understand. Using listviews seems to be a good way to go. I found this website

http://geekswithblogs.net/QuandaryPhase/archive/2008/10/19/asp.net-alternatives-to-dynamic-controls---part-1.aspx

And I got the results I wanted.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号