单击按钮时动态添加文本框到面板
我只是不明白这是怎么做到的。我在这里和其他一些网站上解决了几个问题。
基本上,一家公司将添加流程步骤,我希望有一个文本框,旁边有一个按钮,上面写着“添加另一个步骤”。单击后,当前文本框下方将出现一个新文本框,并且该按钮将移动到新文本框旁边。我需要做什么?
I just don't understand how this is done. I've gone through several questions 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一旦您询问如何维护 ViewState,事情就会变得更加复杂。但是,由于您还没有问这个问题,所以简单的答案就是在按钮单击事件上,您应该实例化一个新的 TextBox 并将其插入按钮之前的控件中。
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
Link
And I got the results I wanted.