当我们点击添加按钮时,如何将textbox1,textbox2的内容添加到列表box1,listbox2? [英] how to add the content of textbox1, textbox2 to list box1,listbox2 when we click on add button?

查看:81
本文介绍了当我们点击添加按钮时,如何将textbox1,textbox2的内容添加到列表box1,listbox2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要求

两个文本框,两个列表框,添加按钮。如何在asp.net中创建这些控件之间的链接...在web表单中

解决方案

你可以谷歌搜索简单的问题。



尝试这样..



<前lang =c#> 受保护 void btnAdd_Click( object sender,EventArgs e)
{
ListBox1。 Items.Add(TextBox1.Text);
ListBox2.Items.Add(TextBox2.Text);
}







参考:列表框中的添加项 [ ^ ]


这些线程可能会有所帮助 -

http://www.dreamincode.net/forums/topic/245158-how-do-i-add-text-box-text-to-a-list-box/ [ ^ ]

http://forums.asp.net/t/1200989 .aspx [ ^ ]


requirement
two textboxes, two listboxes, add button . how to create link between these controls in asp.net... i.e.s in web forms

解决方案

You can google for simple issues.

try like this..

protected void btnAdd_Click(object sender, EventArgs e)
       {
           ListBox1.Items.Add(TextBox1.Text);
           ListBox2.Items.Add(TextBox2.Text);
       }




Reference: Additems in listbox [^]


These threads might help -
http://www.dreamincode.net/forums/topic/245158-how-do-i-add-text-box-text-to-a-list-box/[^]
http://forums.asp.net/t/1200989.aspx[^]


这篇关于当我们点击添加按钮时,如何将textbox1,textbox2的内容添加到列表box1,listbox2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆