如何通过Asp.net中的ListBox检索TextBox中的值 [英] How to retrieve values in TextBox through ListBox in Asp.net

查看:71
本文介绍了如何通过Asp.net中的ListBox检索TextBox中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在列表框中选择一个值时,所有与该ID对应的详细信息都应显示在相应的文本框中.
示例:

When u select a value in list box, all the details correspond to that ID, should display in respected text boxes.
Example:

Emp_ID:       ListBox
Emp_Name:     TextBox
Emp_Add:      TextBox
Emp_email:    TextBox
Emp_PhoneNo:  TextBox


如果在列表框中选择值,则文本框字段应从数据库自动检索值.那是什么代码.
请帮帮我.


If you select value in listbox, textbox fields should retrieve values automitically from database. Whats the code for that.
Please help me out.

推荐答案

如果您要绑定ListBox来表示BindingList,则可以使用BindingLists的ListChanged事件. ListChangedEventArgs有一个参数ListChangedType,它告诉您是否添加,删除,移动或更改了项目.

您可以使用类似的收藏集来做类似的事情.

如果您自己添加或删除项目,显然可以直接告诉其他代码执行,或者您可以自己创建和引发一个事件,前提是您有一个ListAdded事件:

If you''re binding your ListBox to say a BindingList, you can use the BindingLists''s ListChanged event. The ListChangedEventArgs has an argument ListChangedType which tells you if an item was added, removed, moved or changed.

You can do similar things with similar collections.

If you''re adding or removing items yourself, you can obviously directly tell some other piece of code to execute or you can just create and raise an event yourself, provided you have a ListAdded event:

ListAdded(this, new ListAddedEventArgs() { List = myList, Item = myItem });


这篇关于如何通过Asp.net中的ListBox检索TextBox中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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