Home Forums WinForms controls Xceed Grid for WinForms trouble using GridComboBox as CellViewer Reply To: trouble using GridComboBox as CellViewer

User (Old forums)
Member
Post count: 23064

Hi tommy, here is the code i have

I would like to show a combobox in each cell. and here is the code i have now.

_gridDataSet = GetDataSet();
gridControlOrder.BeginInit();
gridControlOrder.DataSource=_gridDataSet;
gridControlOrder.DataMember=”Orders”;

DetailGrid detail = new DetailGrid();
detail.HeaderRows.Add( new ColumnManagerRow() );
detail.DataSource = _gridDataSet;
detail.DataMember = “Orders.OrdersItems”;
gridControlOrder.DetailGridTemplates.Clear();
gridControlOrder.DetailGridTemplates.Add( detail );
detail.Columns[0].ReadOnly=false;

_gridEditor = new GridComboBox();
detail.Columns[0].CellEditor= _gridEditor;

_gridViewer = new GridComboBox();

DataTable dt = new DataTable();
dt.Columns.Add(“display”);
dt.Columns.Add(“valuemember”);

System.Data.DataRow dr = dt.NewRow();
dr[0] = Context.GetResourceString(“TypeOne”);
dr[1]= Context.GetResourceString(“TypeTOneValue”);
dt.Rows.Add(dr);

dr[0] = Context.GetResourceString(“TypeTwo”);
dr[1]= Context.GetResourceString(“TypeTwoValue”);
dt.Rows.Add(dr);

_gridViewerbox = new GridComboBox();
_gridViewerbox.DataSource = dt;
_gridViewerbox.DisplayMember = “display”;
_gridViewerbox.ValueMember = “valuemember”;

detail.Columns[0].CellViewer = _gridViewerbox;

foreach(Cell cell in detail.DataRowTemplate.Cells)
{
if (cell.ParentColumn.Index==0)
cell.EnteringEdit += new EnteringEditEventHandler( this.cell_EnteringEdit );
}

gridControlOrder.EndInit();

* on the cell.enteringEdit event. I populate the _gridEditor combobox with the value i want depending on the selected cell.

— the editing is working fine, but i dont see any comboboxes when the form is displayed intailly.

thanks!

Imported from legacy forums. Posted by userX (had 423 views)