数据绑定难题~~~~在线急等啊
各位高手,哪位知道怎么把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);