首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

数据绑定难点~在线急等啊

2011-12-15 
数据绑定难题~~~~在线急等啊各位高手,哪位知道怎么把DS数据绑定到datagridview控件里的下拉框里啊!!!急啊[

数据绑定难题~~~~在线急等啊
各位高手,哪位知道怎么把DS数据绑定到datagridview控件里的下拉框里啊!!!
急啊

[解决办法]
关注,没处理过,也没思路~~~飘
[解决办法]
大致应该是这样吧....
DropDownList1.DataSource = DS;
DropDownList1.DataTextField = DS.Table[0].Colums[0]
DropDownList1.DataValueField = DS.Table[0].Colums[1]
[解决办法]
DropDownList1.DataSource = DS;
DropDownList1.DataTextField = "name "
DropDownList1.DataValueField = "id "
[解决办法]
DropDownList1.DataSource = DS;
DropDownList1.DataTextField = "name "
DropDownList1.DataValueField = "id "

--------------------------------------
正解
DataTextField和DataValueField 不能少
[解决办法]
source = new DataGridViewComboBoxColumn();
source.Name = "SourceField ";
source.DataSource = _dsSource.Tables[0];
source.ValueMember = "name ";
source.DisplayMember = "name ";
grdView.Columns.Add(source);

destination = new DataGridViewComboBoxColumn();
destination.DataSource = _dsDest.Tables[0];
destination.Name = "Destination ";
destination.ValueMember = "name ";
destination.DisplayMember = "name ";
grdView.Columns.Add(destination);

热点排行