如何绑定选中的列表框? [英] How can bind checked list box?
本文介绍了如何绑定选中的列表框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI,
我需要解决方案来绑定选中的列表框.
I need solution to bind checked listbox.
con.Open();
da = new SqlDataAdapter("select sublocationfgn from sublocationfgn order by sublocationfgn", con);
dt = new DataTable();
da.Fill(dt);
cmbSubLocationFgn.DataSource = dt;
cmbSubLocationFgn.DisplayMember = "SubLocationFgn";
con.Close();
这是绑定组合框的方法.但是通过这种方式,我无法绑定选中的列表框.
所以请给我答案来绑定选中的列表框.
谢谢&问候,
Viswanathan.M
This is the way to bind combo box.But by this way ican''t bind checked listbox.
so pls give me answer to bind checked listbox.
Thanks & Regards,
Viswanathan.M
推荐答案
您提供给我们的代码并未显示您如何尝试将DataTable
绑定到ListBox
.
确保您设置了以下内容(或进行了适合控件的所有操作):
The code you''ve given us doesn''t show how you''re trying to bind theDataTable
to theListBox
.
Make sure you''re setting the following (or doing whatever is appropriate for the control):
ListBox.DataSource<br />
ListBox.DataTextField<br />
ListBox.dataValueField
并调用ListBox.DataBind()
and calling ListBox.DataBind()
这篇关于如何绑定选中的列表框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文