我有一个像
这样的通用列表List<return> returnlist
class return
{
public string returnid {get; set;
...
public List<string> Vouchernumbers
}
我将返回列表绑定到telerik radgridview。
如何将凭证列表绑定到每行的GridviewCombobox列?
我在radgridview_complete_binding之后将优惠券列表绑定到组合框。
答案 0 :(得分:0)
将字符串分配给datasource
comboColumn.DataSource = new String [] {&#34; Test1&#34;,&#34; Test2&#34;};
您也可以绑定集合:
Binding list BindingList<ComboBoxDataSourceObject> list = new BindingList<ComboBoxDataSourceObject>();
ComboBoxDataSourceObject object1 = new ComboBoxDataSourceObject();
object1.Id = 1;
object1.MyString = "Test 1";
list.Add(object1);
ComboBoxDataSourceObject object2 = new ComboBoxDataSourceObject();
object2.Id = 2;
object2.MyString = "Test 2";
list.Add(object2);
colboCol2.DataSource = list;
radGridView1.Columns.Add(colboCol2);
答案 1 :(得分:0)
创建radcombobox并设置数据源并将其添加到rad grid
例如:
GridViewComboBoxColumn col = new GridViewComboBoxColumn();
col.DataSource = DAL.ActiveDb.GetList<SalesRep>().ToList().OrderBy(x => x.RepName).Select(x => new { Id = x.Id, x.RepName });
col.DropDownStyle = RadDropDownStyle.DropDown;
col.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
col.DisplayMember = "RepName";
col.ValueMember = "Id";
col.FieldName = "RepId";
col.HeaderText = "Rep Name";
col.Width = 200;
//var t = gridColInfo.Where(x => x.ColumnName.ToLower() == "repid").FirstOrDefault();
//if (t != null)
//{
// col.Width = t.ColumnWidth;
//}
this.radGridBillwiseOpening.Columns.Add(col);