1

I have a generic List like

List<return> returnlist 

class return
{
  public string returnid {get; set;
  ...
  public List<string> Vouchernumbers
}

I bind the returnlist to the telerik radgridview.

How can i bind the voucherlist to the GridviewComboboxcolumn for each row ?

I have bind the voucherlist to the combobox after radgridview_complete_binding.

Sunlog
  • 269
  • 1
  • 3
  • 13

2 Answers2

0
  1. You need to create the grid with columns and data
  2. You need to add the combobox column, initialize it.. Please check you need to have a dataeditor in here
  3. Assign the string to datasource

    comboColumn.DataSource = new String[] { "Test1", "Test2"};

  4. You can bind the collections too:

    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);
    
  • [Please check the explanation from telerik](http://www.telerik.com/help/winforms/gridview-columns-gridviewcomboboxcolumn.html) – Ghali Sriparthu Feb 04 '16 at 11:54
  • This is not the problem. I want to bind the voucherlist for each row in the radgrid. I have bind the voucherlist after radgrid_binding_complete, but the column shows nothing. – Sunlog Feb 05 '16 at 14:35
0

create radcombobox and set datasource and add it to rad grid

eg :

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);
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Taja_100
  • 453
  • 6
  • 15