ListBox控件ASP.Net C# [英] ListBox control ASP.Net C#
本文介绍了ListBox控件ASP.Net C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将列表框绑定到数据集.但是我的列表框没有
Hi,
I am trying to bind a listbox to a dataset. But my listbox does not have the
.DisplayMember
和
.ValueMember
属性.我需要包含一些DLL吗?还是我的Visual Studio版本不支持它?
谢谢!
Franco Cipriano
property. Do I need to include some DLL? or is my version of Visual studio does not support it?
Thanks!
Franco Cipriano
推荐答案
您好,Franco,ListBox不包含任何称为DisplayMember或ValueMember的属性.代替此,您需要使用列表框的DataTextField和DataValueField属性:-
Hi Franco, ListBox does not contain any property called DisplayMember or ValueMember. Instead of this you need to use DataTextField and DataValueField property of List Box:-
myListBox.DataSource = ds;
myListBox.DataTextField = "Emp_Name";
myListBox.DataValueField = "Emp_Id";
myListBox.DataBind();
希望你明白了.
祝你好运.
Hope you got it.
Good luck.
这篇关于ListBox控件ASP.Net C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文