如何在运行时通过单击按钮动态生成 TextBox 控件?对于每个按钮单击,我想创建一个 TextBox 控件以及相应的动态标签.我想使用 C# 语言在 ASP.NET 中执行此操作.
How does one dynamically generate a TextBox control at run-time as a result of a button click? For each button click, I would like to create a TextBox control along with corresponding dynamic labels. I would like to do this within ASP.NET using the C# language.
TextBox txt = new TextBox();
txt.ID = "textBox1";
txt.Text = "helloo";
form1.Controls.Add(txt);
Label lbl = new Label();
lbl.Text = "I am a label";
form1.Controls.Add(lbl);
这篇关于如何动态生成 TextBox 控件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!