如何为多个地址添加多个文本框 [英] How to add multiple textboxes for multiple addresses
本文介绍了如何为多个地址添加多个文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我正在开发Web应用程序,并且想为客户端添加多个地址.
如果用户单击图标或按钮,则会出现一个新的文本框,我可以在其中添加其他地址,依此类推.单击删除"按钮时,该文本框也应被删除.
请帮帮我.
在此先感谢.
Bye
Hello,
I am working on an web application and I want to add multiple addresses for the client.
If the user clicks on an icon or a button a new Textbox should appear where I can add his other address and so on.The textbox should also get removed when I click on Remove button.
Please help me.
Thanks in Advance.
Bye
推荐答案
hi,
这会有所帮助
http://support.microsoft.com/kb/317794 [
this will help
http://support.microsoft.com/kb/317794[^]
happy coding
尝试一下..
http://www.mkyong.com/jquery/how-to -add-remove-textbox-dynamically-with-jquery/ [
Try this..
http://www.mkyong.com/jquery/how-to-add-remove-textbox-dynamically-with-jquery/[^]
这可能对您有帮助...
首先,您需要一个面板或使用div runat = server,我们假设其ID为dynemicContent
This may help you......
first you need one Panel or use div runat=server, we assume its id is dynemicContent
private void btnAdd_Click(object sender, EventArgs e)
{
TextBox t = new TextBox();
t.Name = "yourName"; // give the different name each and every time
// set other property here.....
Button b = new Button();
b.Name = "yourName"; // give the different name each and every time
b.Text = "Add";
// set other property here....
// Register event of button...
b.Click += new EventHandler(btnAdd_Click);
this.dynemicContent.Controls.Add(t);
this.dynemicContent.Controls.Add(b);
}
这篇关于如何为多个地址添加多个文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文